View Full Version : Dynamically adding items to a toolbar (should be an easy question)

20 Feb 2011, 2:17 PM
Hi all, i have a toolbar which is set up like so:

MyApp.Guide.channelbar = new Ext.Toolbar({
items: [
text: 'loading...',
ui: 'plain',
disabled: true

It displays on the screen as expected, and looks just fine. So later on, i make a JSONP request and in the callback, i try to remove the loading item and insert a segmented button like so:

new Ext.SegmentedButton({
name: 'testseg',
items: [{text:'test a'},{text:'test b'}]

Now i'm *certain* that callback is getting called, because in chrome's console i do the following to confirm that the item has been added:


But it just doesn't get updated on the screen. What am i missing?

20 Feb 2011, 3:58 PM
Don't add the button to the item object.

MyApp.Guide.channelbar.add({ ... })

20 Feb 2011, 4:18 PM
Also found i needed to call doLayout() on the toolbar too.