我有一个Ext.window.Window
,它是它自己的控制器(2个中的1个)。该窗口有一个按钮,可将行添加到网格。它添加的行数与events
ajax调用后触发的save
的数量直接相关。
如何在每次打开窗口时重置这些事件? save
成功后,我正在重新初始化窗口。
该窗口经常使用,需要为closeAction: 'hide'
代码
var controller = this, // Window Controller
activeRec = controller.activeRecord,
store = Ext.getStore('Manage'), // Store for the window
window = Ext.getCmp('window'), // window component
submitMask = new Ext.LoadMask({target: window, msg: 'Saving data...'}),
saveButton = Ext.ComponentQuery.query('#am_save_button');
Ext.Ajax.request({
url: '/save',
method: 'POST',
jsonData: jsonChanges,
scope: this,
success: function (response, batch) {
store.load();
window.record = activeRec;
controller.init();
saveButton[0].disable();
submitMask.hide();
},
[...]
});
控制台
dispatch
<this>: (optimized away)
args: (2) […]
arguments: Arguments
bus: (optimized away)
controllers: {…}
ev: "click"
event: {…}
events: (4) […] <-- needs to be '1'
i: 0
id: "AccountsManagementController"
ln: 4
me: {…}
selector: "accounts_management_grid button[name=\"am_add_account\"]"
selectors: {…}
target: {…}
答案 0 :(得分:0)
我简化了success
,现在可以使用了。怀疑应该归咎于init
的呼叫:
success: function (response, batch) {
window.record = activeRec;
saveButton[0].disable();
submitMask.hide();
},