PDA

View Full Version : catching change on menu in mvc



Anthony.Hall
7 Mar 2012, 3:56 AM
i'm having a few issues catching the change event on menu

I've tried the following in my controller


'#selectFilter': { selectionchange: this.onSelectFilter,
change: this.onSelectFilter,
itemmousedown: this.onSelectFilter
},



items:[
{
xtype:'panel',
layout:{
type:'column'
},
// border:0,
columnWidth:0.5,
tbar: [{
xtype : 'button',
id: 'selectFilter',
text : 'Select Filter By',
itemId : 'filter_by',
arrowAlign : 'right',
menu : [{
text : 'Client',
checked : true,
group : 'filter',
itemId : 'ClientFrom',
id : 'ClientFrom'
},{
text : 'Supplier',
checked : false,
group : 'filter',
itemId : 'Supplier'
},{
text : 'Delivery',
checked : false,
group : 'filter',
itemId : 'Delivery'
}]
}]
}
]

vietits
7 Mar 2012, 7:15 AM
1. Menu does not have 'change' event. You should catch 'click' event when user click on one of its items.

2. You should use id or itemId but not both. In case you use both, itemId will have higher priority.

Below is my suggestion basing on your code:


'#filter_by menu':{ // use itemId in selector
click: function(menu, item){
console.log('item clicked', item);
}
}