Thanks for your prompt reply, however it didn’t seem to work.
I am using the code below:
aMenuBar=new dhtmlXMenuBarObject(document.getElementById(‘xpstyle’),‘100%’,22,’’);
aMenuBar.setOnClickHandler(onButtonClick);
aMenuBar.setGfxPath(’./include/Menu/img/’);
aMenuBar.loadXML(’./include/Menu/_menu.xml’);
aMenuBar.showBar();
children = aMenuBar.getPanel(‘booking_action’).items;
aMenuBar.hideItem(children[1].id)
The _menu.xml contains:
<?xml version='1.0' ?>
<MenuItem name=“Unbook” id=“btn_Unbook”/>
And when I run the script I get the error:
Any Ideas
children[1] has no properties
The code is correct problem caused by the timing.
The loading of XML is async., so you need to catch moment when data loaded , it can be done as
aMenuBar.showBar();
aMenuBar.loadXML(’./include/Menu/_menu.xml’,function(){
// code here will be called only after xml loading
children = aMenuBar.getPanel(‘booking_action’).items;
aMenuBar.hideItem(children[1].id)
});