I have a problem with loading content on tab cell re-init. There’s layout cell A, with a tree loaded from xml and layout cell B, with a tabbar attached to it. Every time a tree item is clicked a new tab cell is added and it’s content is loaded with iframes. Everything works fine until I close the tab. After this event, when I click again on the same tree item, the tab is added but does not work as supposed, meaning it has no focus and no content. I’ve tried to check if tree item was clicked for the first time or not, but it’s not working. Anyone knows how to solve this? Thank you and sorry for my bad english, it’s not my native language.
//create tabbar
myTabbar = myLayout.cells("b").attachTabbar();//attach tabbar to cell b
myTabbar.setImagePath("dhtmlxSuite/dhtmlx_std_full/imgs/");
myTabbar.setHrefMode("ajax-html");
myTabbar.addTab("a1","start","150px");
myTabbar.setSkinColors("#CCCCCC","#F4F3EE");
myTabbar.setContentHref("a1","start.php");
myTabbar.setTabActive("a1");
myTabbar.enableTabCloseButton(true);
// Tabbar onClose event
myTabbar.attachEvent("onTabClose", function(id) {
alert("tab with id " +id + " was closed"); //check tab id
myTabbar.setTabActive("a1");
return true;
});
//create tree
myTree = myLayout.cells("a").attachTree("0"); //add tree obj in cell a
myTree.setImagePath("dhtmlxSuite/dhtmlx_std_full/imgs/csh_bluefolders/");//set img path for tree
myTree.loadXML("tree.xml");//load tree from xml
//attach tab cells
myTree.attachEvent("onClick",function(textSelected){
var textSelected = myTree.getSelectedItemText();
if(textSelected == 'text 1'){
//check if tab id exist
if (!myTabbar.cells("a2")){
myTabbar.addTab("a2","text1","150px");
myTabbar.setHrefMode("iframes");
myTabbar.setContent("a2","list1")
myTabbar.setTabActive("a2");
document.getElementById("frm").target = "a2";
}
else{
myTabbar.setTabActive("a2");
}
}
return true;
} );//end tree event