PDA

View Full Version : Change toolbar items



Considerate
6 Aug 2010, 4:51 PM
Hi, this is a cross post of this (http://www.sencha.com/forum/showthread.php?106441-Using-list-to-navigate-with-disclosure-or-click-(kitchen-sink-structure)) post but I thought it would be better if I posted with a title that says more about what I want to accomplish.

My problem is basically that I want to edit a toolbar but even if I do and call
doLayout() on the object later nothing updates. The method setTitle works fine for the title of a toolbar, it gets updated like it should but I couldn't find any equivalent method for buttons. What should I do if I want to change the buttons of a toolbar?

Thank you for taking you time.

//Considerate

nosarious
7 Aug 2010, 11:36 AM
Wouldn't it be easier to have different toolbars that you can call depending on the situation at hand? Rather than hiding/showing/renaming? The toolbars demo has three toolbars that you could call at different points where you need them.

evant
8 Aug 2010, 8:19 PM
Simple example of changing the buttons:



Ext.setup({
onReady: function(){
var p = new Ext.Panel({
fullscreen: true,
dockedItems: [{
xtype: 'toolbar',
dock: 'top',
items: [{
text: 'Foo'
},{
text: 'Bar',
handler: function(){
var toolbar = p.dockedItems.first();
toolbar.removeAll();
Ext.each(['New', 'items', 'here'], function(name){
toolbar.add({
text: name
});
});
toolbar.doLayout();
}
}]
}]
});
}
});

Considerate
9 Aug 2010, 4:03 AM
Thank you for your help. I really appreciate it.

//Considerate