Reload tabbar using loadXML fails with invalid pointer

Hi,

I am strugling with option to reload tabbar based on user rights. User with restricted rights should have less tabs available.

I succeeded in reloading toolbar using xml, but I fail with tabbar and I have no idea why. When I load one tabbar or second tabbar alone everything is fine. When I load one tabbar, than call clearAll method and load other tabbar I receive invalid pointer exception on this line of code: that.dhxcont.mainCont.appendChild(obj)

The problem might be that tabbar is not loaded completelly and method clearAll does not erase anything as this will be filled later or I do not know. I debugged the code and clearAll method just jumps over those _tabs as it is empty.

Is there a way to solve my problem somehow? We would like to keep xml files for tabbars as we see it quite logical and separated logic is nice and easily readable… We cannot decide only once during page lifetime that user has or has not rights as for one type of object user has those rights and for other type of objects user does not have those rights. It must be done during life of once loaded html page. When for example user changes one combobox value the tabbar should be reloaded.

Here is a sample code…
Layout.loadTabbarXML(“tabbarProductionPlanDetailNoPlanner.xml”);
Layout.attachTabbarEvent(“onSelect”, function(id, last_id) {
getTabData(id);
return true;
});
Layout.loadTabbarXML(“tabbarProductionPlanDetail.xml”);
Layout.attachTabbarEvent(“onSelect”, function(id, last_id) {
getTabData(id);
return true;
});

where Layout object defines this method:
this.loadTabbarXML = function(xmlFileName) {
this.tabbar.clearAll();
this.tabbar.loadXML(xmlFileName, function() { Layout.translateTabbar(); });
}
attach event method is similar
this.attachTabbarEvent = function(eventName, eventFunction) {
this.tabbar.attachEvent(eventName, eventFunction);
}

BR
Zdenek

Hi,
there was a bug in the 2.6 version, in clearAll() method.
Please try to use attached file instead of the original
dhtmlxtabbar.zip (9.25 KB)

Hi,

thank you for trying to help me. This time it works with one drawback that cause to fail whole operation. On tab divs were defined objects and after this change those are now somehow gone. It means that for example method document.getElementById(‘MYID’) returns null but before it was working.

I have changed in the meanwhile our logic that we just hide and show necessary tabs and now I lack something in xml definition like: hidden=“1”. Is there some option like this? I did not find it in your help.

SCBR 1
<tab id=“b2” width=‘100px’ hidden=“1” href=“somethingelse…”>

I have imlemented it in separate method that is executed after tabbar is loaded and user is not able to see all tabs when not required. At least I have some workaround :slight_smile: Before all tabs were visible for a short time.

BR
Zdenek

Hi,

clearAll revomes tabs and their content. If you want to preserve some content, you need to move it from the tab and then call clearAll method.

now I lack something in xml definition like: hidden=“1”. Is there some option like this?

Unfortunately, tabbar doesn’t provide possibility to pass “hidden” attribute in the xml.