PDA

View Full Version : Redraw button when adding a menu



srp
29 Nov 2010, 12:08 PM
I have some code similar to the following:


function callMeFirst (){
button = new Ext.button({
setSettingsHere: "bla"
});
tb = new Ext.Toolbar({
items: [button]
});
}

function callMeSecond (){
menu = new Ext.menu.Menu({
setSettingsHere: "bla2"
});
button.menu = menu;
}


What I noticed is that the button won't have the little arrow indicating that there is a menu below the button, but the menu still works. If I assign the button a blank menu at creation i.e. ( menu: {items: ""}) then it will have the little arrow and later on I can assign the menu I create later and everything works as I expect.

Is there a way to let the button/renderer know that I added a menu to the button and to show the little arrow pointing down? I've been playing around with this, but so far I haven't come up with anything. Any help would be appreciated.

Thanks.

-Stephen

Condor
30 Nov 2010, 12:33 AM
It's not that simple! You can't just assign a menu to a button and expect it to work.

Instead, I would remove the existing button from the toolbar and add a new one with a menu.