Toolbar cannot disable item

I’m trying to disable an item of my toolbar, but I always get an error: “Uncaught TypeError: Cannot read property ‘disableItem’ of undefined”.
Although I checked the toolbar before it not “undefined” even I can log the method disableItem on console.
But I have no idea why I got error when I call this method either with or without argument.

Here is my code:

toolbar = tabbar.attachToolbar(); toolbar.loadStruct(XML_TEMPLATE); console.log(toolbar.disableItem); toolbar.disableItem('');

I got the error at the last line.
Anyone can help me to explain this case?

Thanks!

loadStruct is async. command
You need to use the after loading callback to execute any operations against toolbar’s items

toolbar.loadStruct(XML_TEMPLATE, function(){ toolbar.disableItem(''); });