...
By changing the value of the view
attribute, you can choose where your view renders. For example, on a user's profile:
Section | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
or on the expanded "canvas" view:
Section | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Here is a list of common views supported by containers. Note that the list of the supported containers is not complete. You should consult each container's wiki page /wiki/spaces/a/pages/526883 or developer documentation to determine what is available:
...
You are not limited to using a single content section for your application. By adding additional Content
sections to your gadget XML spec, you can display entirely different content per view.
Section | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
...
If you have a content section that can be used in multiple views, you can specify multiple comma-separated view names in the view
attribute of the Content
section. The following example renders the same content on the home and profile views:
Section | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
...
The previous gadget will display the following in profile and home views:
Panel | ||
---|---|---|
| ||
This text shows up on all views Elements in this content section will be rendered in all views, making it a good place to put JavaScript utility functions. This text only shows up on the profile and home views. |
In the canvas view, the following is displayed:
Panel | ||
---|---|---|
| ||
This text shows up on all views Elements in this content section will be rendered in all views, making it a good place to put JavaScript utility functions. This text only shows up on the canvas view. |
Subviews
OpenSocial version 0.9 introduces the concept of subviews. A subview is a user-defined label attached to a view that helps developers create multiple-page applications without resorting to JavaScript. For example, a gadget may have a content section defined for the canvas
view, but also a view called canvas.help
, which would contain help documentation for the gadget. The canvas.help
content section is considered a subview and will not be rendered unless explicitly navigated to using a call to gadgets.view.requestNavigateTo('canvas.help')
.
...