Extjs - window 刷新后重置事件

Extjs - Resetting events after a window refresh

我有一个 Ext.window.Window 带有自己的控制器(2 个中的 1 个)。 window 有一个按钮,可以将行添加到网格。它添加的行数与 save ajax 调用后触发的 events 的数量直接相关。

如何在每次 window 出现时重置这些事件?我在 save.

成功后重新初始化 window

window经常用到,需要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: {…}

我简化了我的 success,它现在可以工作了。怀疑 init 调用是罪魁祸首:

    success: function (response, batch) {
        window.record = activeRec;
        saveButton[0].disable();
        submitMask.hide();
    },