您好!
我希望从视图中删除此处理程序“handler:onEventControler(???)”(它不属于那里)
对于网格视图设置dockedItems这个cod:
this.dockedItems = [{
xtype: 'toolbar',
items: [{
xtype: 'newstation'
},{
id: 'add-persone-btn',
xtype: 'button',
itemId: 'add',
text: 'Add',
iconCls: 'icon-add',
handler: onEventControler(???)
}, '-', {
itemId: 'delete',
text: 'Delete',
iconCls: 'icon-delete',
disabled: true,
handler: function(){
var selection = grid.getView().getSelectionModel().getSelection()[0];
if (selection) {
store.remove(selection);
}
}
}]
}]
我还试图实现 this.control ,但我不能要求按钮selectorQuery。
如何正确尊重架构mvc extJs4?
谢谢。答案 0 :(得分:1)
你应该可以在这个视图的控制器中做这样的事情。
init: function () {
this.control({
'toolbar #add': {
click: this.onAddStation
}
});
}
处理程序:
onAddStation: function(button, e, eOpts){
//Handle
}
或者,您可以在按钮上使用“操作”配置。
action: 'addstation'
然后你可以:
init: function () {
this.control({
'button[action=addstation]': {
click: me.onAddStation
}
});
}
答案 1 :(得分:0)
这是视图网格视图的方法“initComponent”:
initComponent: function () {
this.plugins = [Ext.create('Ext.grid.plugin.RowEditing')];
this.dockedItems = [{
xtype: 'toolbar',
items: [{
xtype: 'button',
itemId: 'add',
text: 'Add',
iconCls: 'icon-add',
action: 'add-new-persone'
}, '-', {
itemId: 'delete',
text: 'Delete',
iconCls: 'icon-delete',
action: 'delete-persone',
disabled: true
}, '-', {
itemId: 'synch',
text: 'Synchronization',
iconCls: 'icon-synch',
action: 'synch-persone'
}]
}];
// paging bar on the bottom
this.bbar = Ext.create('Ext.PagingToolbar', {
store: this.store,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: "No topics to display",
items:[]
});
this._initColumns();
this._initFilter();
this.callParent(arguments);
},