Я хочу запустить событие в пользовательском классе, написанном в Extjs 4.
Я создал собственный класс, используя ExtJs и расширен из класса Observable
для регистрации события.
var settingWindows = Ext.define("Setting", {
extend: 'Ext.util.Observable',
title: "",
window: null,
userId: 0,
windowWidth: 650,
windowHeight: 400,
columns: [],
settings: [],
ruleList: [],
isColorPickerOpen: false,
currTrObj: null,
currColorType: null,
constructor: function(config) {
this.windowWidth = config.windowWidth || 650;
this.windowHeight = config.windowHeight || 400;
this.title = config.title || "";
this.userId = config.userId || 0;
this.settings = config.settings || [];
this.CreateWindowSettingsWindows();
this.addEvents('myCustomEvent');
},
});
В constructor
Я добавил регистрацию для myCustomEvent
.
И в вызове ajax я пытаюсь вызвать
Ext.Ajax.request({
url: url,
contentType: "application/json",
method: 'POST',
dataType: 'json',
jsonData: Ext.encode(this.settings),
failure: function(response, options) {
Ext.MessageBox.alert(response.statusText);
},
success: function() {
Ext.MessageBox.alert("Data was updated");
this.fireEvent('myCustomEvent', 1);
}
});
Пожалуйста, просите