PDA

View Full Version : Button toggleHandler function in MVC pattern



adanali
29 Apr 2013, 11:49 PM
How i can define my button's toggleHandler function in MVC pattern?

For example, i can define my button's handler function like this



####This is --- myapp/controller/mybuton.js

Ext.define(myapp.controller.mybuton, {
extend : 'Ext.app.Controller',

init : function () {
this.control({
'#gomybuttonaction' : {
click : this.mybuttonaction
}
})
},

mybuttonaction : function(btn) {
Ext.Msg.alert('Hi', 'This is my window')
},
});




###This is anywhere in my --- myapp/view/mypanel.js

items : [{
xtype : 'button',
id : 'gomybuttonaction' // Here is written instead of handler function
}, {
xtype : 'button',
enableToggle : true,
toggleGroup : 'mybuttons',
toggleHandler : ??? // My question is how i can define this toggleHandler function in MVC pattern like my handler function?
}]



AGAIN : My question is how i can define this toggleHandler function in MVC pattern like my handler function?

slemmon
1 May 2013, 2:14 PM
Buttons have a toggle event you can listen to (instead of click).
http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.button.Button-event-toggle