Displaying Tabs

Advance preparation

OpenSocial has a feature that displays messages to users with tab dialogs. Use of the tabs feature must be declared with Required Elements in Gadget XML in order to use this feature.

Creating a tab

First, the contents for displaying the tab must be prepared. A minimum of 1 element per TabSet and minimum of 1 element per Tab are necessary in the contents.

The following is sample code for handling these contents as a tab.

  • Specify the ID of the DOM element for the TabSet and generate a TabSet? object with the gadgets.TabSet?() constructor.
  • Add a tab to the TabSet with the addTab() method. The specifiable parameters are as follows.
    • contentContainer: The DOM element that becomes the contents of the tab. A new DOM element is added by default.
    • callback: The callback function called when this tab is selected.
    • tooltip: The tooltip string that is displayed when the cursor is over this tab.
    • index: The location where this tab is inserted. It is added to the end by default.

The method for acquiring the selected tab and explicitly calling the callback function is as follows.

Revision History

  • 12/2010
    • Initial Release.

PREVIOUS

Displaying MiniMessages

NEXT

Writing Diary Entries