Check documentation for the latest version 6.0 of dhtmlxSuite addTab DHTMLX Docs

addTab

adds a new tab to Tabbar

void addTab(string|number id,string text,number width,number position,boolean active,boolean close);

Parameters

idstring|numbertab id
textstringtab text
widthnumber(optional) tab width, null by default, if not number - will be adjusted automatically
positionnumber(optional) tab position, null by default (last tab)
activeboolean(optional) set to true to select the added tab, false by default
closeboolean(optional) set to true to render the Close button, false by default, overrides enableTabCloseButton()

Example

var myTabbar = new dhtmlXTabBar("parentId");
 
// closable, autowidth, select after add
myTabbar.addTab("a1", "Rage", null, null, true, true);
 
// simple tab
myTabbar.addTab("a2", "Motorhead");
 
// fixed width, 1st in a row, not active,
// not closable even if enableTabCloseButton() set to true
myTabbar.addTab("a3", "Poisonblack", 300, 0, false, false);

Change log

The "active" and "close" parameters are added in v4.0.

The "row" param (index of a row) is no longer used, 4.0 tabbar has only 1 row.

Back to top