Events ExtJS 4:如果不使用ExtJS MVC架构,应该在哪里查看实时事件?
使用Sencha ExtJS框架时,视图的事件在该视图的控制器内活动。如果您不使用控制器,那么将事件存储在何处 例如,假设我们的MVC应用程序有一个用户网格(userlist),我们有一个事件“itemdblclick”。我们如何在非MVC应用程序中实现“itemdblclick”Events ExtJS 4:如果不使用ExtJS MVC架构,应该在哪里查看实时事件?,events,extjs,grid,Events,Extjs,Grid,使用Sencha ExtJS框架时,视图的事件在该视图的控制器内活动。如果您不使用控制器,那么将事件存储在何处 例如,假设我们的MVC应用程序有一个用户网格(userlist),我们有一个事件“itemdblclick”。我们如何在非MVC应用程序中实现“itemdblclick” Ext.define('AM.view.user.List' ,{ extend: 'Ext.grid.Panel', alias: 'widget.userlist', title: 'Al
Ext.define('AM.view.user.List' ,{
extend: 'Ext.grid.Panel',
alias: 'widget.userlist',
title: 'All Users',
// we no longer define the Users store in the `initComponent` method
store: 'Users',
...
});
Ext.define('AM.controller.Users', {
extend: 'Ext.app.Controller',
stores: ['Users'],
models: ['User'],
views: [
'user.List',
'user.Edit'
],
init: function() {
this.control({
'viewport > userlist': {
itemdblclick: this.editUser
},
'useredit button[action=save]': {
click: this.updateUser
}
});
},
editUser: function(grid, record) {
var view = Ext.widget('useredit');
view.down('form').loadRecord(record);
},
updateUser: function(button) {
console.log('clicked the Save button');
var win =
button.up('window'),
form = win.down('form'),
record = form.getRecord(),
values = form.getValues();
record.set(values);
win.close();
// synchronize the store after editing the record
this.getUsersStore().sync();
}
});
它们应该存在于组件(实际上是可观察对象)的侦听器属性中,如下所示: 文件:
为什么这段代码在Mozilla Firefox中不起作用?它在Google Chrome中工作。firefox不喜欢没有参数的alert():)修复了它。