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