View Full Version : Toolbar bug?

21 Apr 2008, 8:24 PM
I would like to disable or hide the toolbar items. With the code above, only the event beforerender is executed and the items count is 0. How i can check all the items?

new Ext.Toolbar({
id: "titem-add",
text:'Add Button',
handler: Ext.emptyFn
}, "-", {
id: "titem-other",
text: 'Other Button',
handler: Ext.emptyFn
beforeshow: function(toolbar){
console.log("beforeshow", toolbar.items.getCount());
beforerender: function(toolbar){
console.log("beforerender", toolbar.items.getCount());

Thank's in advance.

21 Apr 2008, 8:32 PM
beforeshow and beforerender aren't what you need.

You want to check the items?

If you want to disable the items by default, then you can used the 'disabled' config set to true on the individual items.

If you want to go through a list of rendered items, use the 'render' event. (can be thought of as 'afterrender')

21 Apr 2008, 11:18 PM
My principal problem is access to items, because toolbar.items.getCount() is 0, in all events. How I can go through a list of rendered items?


22 Apr 2008, 5:07 PM
Even using the 'render' event?

Are you sure you're looking at the right toolbar? Maybe assign an id to the toolbar and use Ext.getCmp('toolbarid').items.getCount()

What's the endgame here? You want to iterate through, right when it's created? Or at user-action specified times? (ie the user does something that triggers the items to be disabled)