а

Issue about Tabbar


#1

If a tabbar created in another tabbar, and add “onTabClick” event on parent tabbar. First time click the parent tabbar and the child tabbar created successfully, but second time will throw exception “TypeError: this.showHeader is not a function”. I think it is an issue, so could you please help me to resolve it?

Code like below:

var myTabbar = new dhtmlXTabBar({
    parent: "test",    // id/object, parent container where tabbar will be located
    skin: "dhx_skyblue",  // string, tabbar skin, optional
    mode: "top",          // string, top or bottom tabs mode, optional
    align: "left",         // string, left or right tabs align, optional
    close_button: false,           // boolean, render closing button on tabs, optional
    content_zone: true,           // boolean, enable/disable content zone, optional
	tabs: [
		{id: "a1", text: "test", active: true},
	]
});

myTabbar.attachEvent("onTabClick", function(id, lastId) {
	if (id == "a1") {
		var myTabbar1 = myTabbar.tabs("a1").attachTabbar({
		align: "left",
		mode: "top",
		tabs: [
			{id: "b1", text: "test1", active: true},
			]
		});
	}
});

#2

Please, try to check if the tab already has the attached component before attaching again:

myTabbar.attachEvent("onTabClick", function(id, lastId) {
	if (id == "a1" && !myTabbar.tabs("a1").getAttachedObject()) { //check for the attached object!
		var myTabbar1 = myTabbar.tabs("a1").attachTabbar({
		align: "left",
		mode: "top",
		tabs: [
			{id: "b1", text: "test1", active: true},
			]
		});
	}
});
```