Ryu*_*yuk 5 javascript extjs extjs4
store.loadData 是否在 ExtJs 4.2.5 上的商店上触发 load 事件?
文档说明它确实如此:http : //docs-devel.sencha.com/extjs/4.2.5/#!/api/Ext.data.Store-method-loadData
但考虑到我所经历的,它看起来不像它,而且还查看了源代码:
loadData: function(data, append) {
var length = data.length,
newData = [],
i;
//make sure each data element is an Ext.data.Model instance
for (i = 0; i < length; i++) {
newData.push(this.createModel(data[i]));
}
this.loadRecords(newData, append ? this.addRecordsOptions : undefined);
},
Run Code Online (Sandbox Code Playgroud)
好的,所以可能 loadRecords 正在触发它吗?
loadRecords: function(records, options) {
var me = this,
i = 0,
length = records.length,
start,
addRecords,
snapshot = me.snapshot;
if (options) {
start = options.start;
addRecords = options.addRecords;
}
if (!addRecords) {
delete me.snapshot;
me.clearData(true);
} else if (snapshot) {
snapshot.addAll(records);
}
me.data.addAll(records);
if (start !== undefined) {
for (; i < length; i++) {
records[i].index = start + i;
records[i].join(me);
}
} else {
for (; i < length; i++) {
records[i].join(me);
}
}
/*
* this rather inelegant suspension and resumption of events is required because both the filter and sort functions
* fire an additional datachanged event, which is not wanted. Ideally we would do this a different way. The first
* datachanged event is fired by the call to this.add, above.
*/
me.suspendEvents();
if (me.filterOnLoad && !me.remoteFilter) {
me.filter();
}
if (me.sortOnLoad && !me.remoteSort) {
me.sort();
}
me.resumeEvents();
if (me.isGrouped()) {
me.constructGroups();
}
me.fireEvent('datachanged', me);
me.fireEvent('refresh', me);
},
Run Code Online (Sandbox Code Playgroud)
它也没有在那里被解雇。
这是一个已知问题还是我遗漏了什么?