Skip to content
Sitemason - Build on Us

Tab Class Reference

Methods

addTabAfter

(tab object) addTabAfter( object );
A tab config object defining a new tab.
The new tab object.

Information

addTabAfter() creates a new tab, placing it after the current tab.

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

addTabBefore

(tab object) addTabBefore( object );
A tab config object defining a new tab.
The new tab object.

Information

addTabBefore() creates a new tab, placing it before the current tab.

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

getContentItem

(content item object) getContentItem( string or index number );
The name of the content item to be retrieved as a string or the index number of the item.
A content item object.

Information

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

Since the return value is a content item object, content item methods can be chained onto the getContentItem() method, as in:

tab.getContentItem('subtitle').remove();

	var subtitle = tab.getContentItem('subtitle');	

getContentItemNames

(array) getContentItemNames();
Returns an array of content item field names.

Information

getContentItemNames() returns an array of the names of content items in the current tab that have names assigned to them. The array is in order of the content items as they appear in the tab.

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

	var contentItemNames = tab.getContentItemNames();
console.dir(contentItemNames);	

getContentItems

(array) getContentItems();
An array of content item objects.

Information

getContentItems() returns an array of the content items in the current tab. The array is in order of the content items as they appear in the tab.

	var contentItems = tab.getContentItems();
console.dir(contentItems);	

getListColumn

(column object) getListColumn( string or index number );
The name of the column to be retrieved as a string or the index number of the column.
A list column object.

Information

getListColumn() is the primary method for retrieving a list's column. The parameter can be the name of the column as a string or the index number of the column in the list, the first column being 0.

Since the return value is a column object, list column methods can be chained onto the getListColumn() method, as in:

tab.getListColumn('title').remove();

	var titleColumn = tab.getListColumn('title');	

getListColumnNames

(array) getListColumnNames();
Returns an array of column names.

Information

getListColumnNames() returns an array of the names of columns in the current tab's list. The array is in order of the columns as they appear in the list.

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

	var columnNames = tab.getListColumnNames();
console.dir(columnNames);	

getListColumns

(array) getListColumns();
An array of list column objects.

Information

getListColumns() returns an array of the list columns in the current tab. The array is in order of the columns as they appear in the list.

	var listColumns = tab.getListColumns();	

remove

remove();

Information

Removes the current tab.

	tab.remove();	

replace

(tab object) replace( object );
A tab config object defining a new tab.
The new tab object.

Information

replace() replaces the current tab with a new one.

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

set

set( string, string );
The name of the value to be set, the value to which it should be set

Information

Change an attribute of a tab object. Currently, only changing the 'label' is supported.

	tab.set('label', 'My New Tab');