Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

NeedsExamples

gadgets.views

Provides operations for dealing with views. See also: a:gadgets.views.View

Methods

gadgets.views.bind

;<static> String gadgets.views.bind(urlTemplate, environment)

Parameters
NameTypeDescription|

urlTemplate

String

A url template for a container view

environment

Array

A set of named variables of type string (for example, OWNER, PATH, PARAMS, NAME).

Returns
TypeDescription |

String

A URL string

Description
Binds a URL template with variables in the passed environment to produce a URL string. See also: View.getUrlTemplate()

gadgets.views.getCurrentView

;<static> a:gadgets.views.View gadgets.views.getCurrentView()

Returns
TypeDescription |

a:gadgets.views.View

The current view

Description
Returns the current view.

gadgets.views.getParams

;<static> Map.<String|String> gadgets.views.getParams()

Returns
TypeDescription |

Map.<String

String>

The parameter map

Description
Returns the parameters passed into this gadget for this view. Does not include all URL parameters, only the ones passed into gadgets.views.requestNavigateTo.

gadgets.views.getSupportedViews

;<static> Map<gadgets.views.ViewType | String|gadgets.views.View> gadgets.views.getSupportedViews()

Returns
TypeDescription |

Map<gadgets.views.ViewType

String

gadgets.views.View>

All supported views, keyed by their name attribute.

Description
Returns a map of all the supported views. Keys each gadgets.view.View by its name. This function only returns the primary views and does not return any secondary views. Example: if the markup indicates a set of views named Canvas.About, Profile.About, Home.About, Canvas.Help the returned views will only be Canvas, Profile, Home.

gadgets.views.requestNavigateTo

;<static> gadgets.views.requestNavigateTo(view, opt_params, opt_ownerId)

Parameters
NameTypeDescription |

view

String

gadgets.views.View

{string} view If set to a string, the name of the view to navigate to. If set to a View, the View object to navigate to. Passing a View has been deprecated.

opt_params

Map.<String

String>

{string} opt_params If the value is an object, it represents parameters to pass to the gadget after it has been navigated to on the surface. If the view navigated to contains an href and opt_params is a string, the value in opt_params is treated as a relative path that must be resolved relative to the href of the referenced view according to RFC 3986. If opt_params is a string all query parameters including query parameters encoded in a fragment are available in the receiving view using gadgets.views.getParams()

opt_ownerId

String

The ID of the owner of the page to navigate to; defaults to the current owner

Description
Attempts to navigate to this gadget in a different view. If the container supports parameter passing it will pass the optional parameters along to the gadget in the new view. This also allows for navigation to named views on the current surface. Views are composed of names that are Surface(.Secondary)?. The canonical Surface names are Canvas, Profile, Home. The Secondary names are user defined. When navigating from Surface.valueX to Surface.valueY, the container can stay on the same Surface but will show the appropriate <Content> sections whose View is Surface.valueY. When navigating from SurfaceA.Secondary to SurfaceB.Secondary, the container will switch to the SurfaceB surface and show the appropriate <Content> sections whose View is SurfaceB.Secondary.In no cases must the .Secondary item ever be declared.

gadgets.views.View

Base interface for all view objects.

gadgets.views.ViewType

Used by a:gadgets.views.Views.

gadgets.views.ViewType.CANVAS

A view where the gadget is displayed in a very large mode. It is typically the main content on the page. The viewer is not always the same as the owner. This field may be used interchangeably with the string 'CANVAS'.

gadgets.views.ViewType.HOME

A view where the gadget is displayed in a small area usually on a page with other gadgets. Typically the viewer is the same as the owner. This field may be used interchangeably with the string 'HOME'.

gadgets.views.ViewType.PREVIEW

A demo view of the gadget. In this view the owner and viewer are not known. This field may be used interchangeably with the string 'PREVIEW'.

gadgets.views.ViewType.PROFILE

A view where the gadget is displayed in a small area usually on a page with other gadgets. The viewer is not always the same as the owner. This field may be used interchangeably with the string 'PROFILE'.

{{ JsApiAlphaList_(v0.9) }}

  • No labels