我想问一下我可以在哪里向我的网格 MVC 添加一个侦听器。
当我这样做时,什么也没有发生:
Ext.define('myApp.view.reslist' ,{
extend: 'Ext.grid.Panel',
alias : 'widget.reslist',
store : 'resStore',
listeners: {
activate: {
fn: function(e){
console.log('reslist panel activated');
}
}
},
dockedItems: [{
xtype: 'pagbar',
store: 'resStore',
dock: 'top',
displayInfo: true
}],
..... rest of grid configs
它适用于点击事件:
listeners: {
activate: {
fn: function(e){
console.log('reslist panel clicked');
}
}
}
注意:我的控制器的 init 仍然是空的:
Ext.define('myApp.controller.resControl', {
extend: 'Ext.app.Controller',
stores: ['resStore'],
models: ['resModel'],
views: ['reslist','pagbar'],
init: function() {
// nothing here
}
});