PDA

View Full Version : Button handler params?



19 Apr 2007, 10:05 AM
Hey guys,

I know that the button will pass item to the handler. What is the second param? I did an alert and it's [object object]



var myNewButton = new Ext.Button('buttonDivID', {
text: 'ButtonTeext',
id: 'newButtonID',
enableToggle: true,
handler: myHandler
});
function myHandler (item, pressed) {
alert(pressed);
}

tryanDLS
19 Apr 2007, 10:30 AM
Since for the most part everything is an object, debugging with alert is a waste of time - use firebug. The 2nd arg is the event object.

19 Apr 2007, 10:55 AM
you da man.

i got:
myHandler (Object text=Critical id=myBtn enableToggle=true, Object browserEvent=Event click button=0 shiftKey=false)

I was under the assumption that the button will pass the pressed status if enableToggle is set to true. I'll just have to test the button directly for pressed status.

I know that Ext.Toolbar.Button behaves this way.