public
Created

  • Download Gist
FIXME
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
/**
* Loads an array of {@Ext.data.Model model} instances into the store, fires the datachanged event. This should only usually
* be called internally when loading from the {@link Ext.data.Proxy Proxy}, when adding records manually use {@link #add} instead
* @param {Array} records The array of records to load
* @param {Boolean} add True to add these records to the existing records, false to remove the Store's existing records first
*/
loadRecords: function(records, add) {
if (!add) {
this.data.clear();
}
this.data.addAll(records);
//FIXME: this is not a good solution. Ed Spencer is totally responsible for this and should be forced to fix it immediately.
for (var i = 0, length = records.length; i < length; i++) {
records[i].needsAdd = false;
records[i].join(this);
}
/*
* 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.
*/
this.suspendEvents();
 
if (this.filterOnLoad && !this.remoteFilter) {
this.filter();
}
 
if (this.sortOnLoad && !this.remoteSort) {
this.sort();
}
 
this.resumeEvents();
this.fireEvent('datachanged', this, records);
},

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.