Create a gist now

Instantly share code, notes, and snippets.

* Loads an array of { model} instances into the store, fires the datachanged event. This should only usually
* be called internally when loading from the {@link 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) {;
//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;
* 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.
if (this.filterOnLoad && !this.remoteFilter) {
if (this.sortOnLoad && !this.remoteSort) {
this.fireEvent('datachanged', this, records);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment