Skip to content
Sitemason - Build on Us

Panel Class Reference

Methods

getTab

(tab object) getTab (string or index number);
The name of the tab to be retrieved as a string or the index number of the tab
A tab object

Information

getTab() is the primary method for retrieving a tab. The parameter can be the name of the tab as a string or the index number of the tab in the sidebar, the first tab being 0.

Since the return value is a tab object, tab methods can be chained onto the getTab() method, as in: this.getTab('subscriptionsTab').remove();

	var tagTab = this.getTab('tagTab');
	

getTabNames

(array) getTabNames ()
Returns an array of tab names

Information

getTabNames() returns an array of the names of tabs in the current panel. The array is in order of the tabs as they appear in the sidebar.

While this method could be used to loop through all tabs to modify each, it is more commonly used simply to see what tabs are available within a panel or for debugging to see if the tabs you created are showing up properly.

	var tabNames = this.getTabNames();
console.dir(tabNames);	

getTabs

(array) getTabs ()
An array of tab objects.

Information

getTabs() returns an array of the tabs in the current panel. The array is in order of the tabs as they appear in the sidebar.

	var tabs = this.getTabs();
console.dir(tabs);
	

removeTab

removeTab (string or index number)
The name of the tab to be retrieved as a string or the index number of the tab.

Information

Removes the specified tab from the sidebar.

	removeTab('subscriptionsTab');
removeTab(3);
	

replaceTab

(tab object) replaceTab (string or index number, object);
The first parameter is the name of the tab to be retrieved as a string or the index number of the tab. The second parameter is an object defining a new tab.
A tab object

Information

replaceTab() allows you to replace an existing tab with a new one. It is identical to using the replace() method on the tab you are replacing.

	var newTab = tab.replaceTab('subscriptionsTab',
    {
        label:  'Test Tab',
        name:   'testTab',
        content: [
            {
                type:   'header',
                value:  'My New Tab'
            }, {
                type:   'text',
                value:  'This is my new tab.'
            }
        ]
    }
);