PDA

View Full Version : [DUPE-239] Store.insert does not fire 'datachanged' event.



JacobGu
31 Aug 2010, 4:22 AM
The documentation for the Store's datachanged event says as follows:

* @event datachanged
* Fires whenever the records in the Store have changed in some way - this could include adding or removing records,
* or updating the data in existing records
* @param {Ext.data.Store} this The data store
*/
'datachanged'

However, the 'insert' method does not fire the event (also called by 'add' method). It should be corrected as follows with red colored code to be added in fix:


insert : function(index, records) {
records = [].concat(records);
for (var i = 0, len = records.length; i < len; i++) {
this.data.insert(index, records[i]);
records[i].join(this);
}
if (this.snapshot) {
this.snapshot.addAll(records);
}
this.fireEvent('add', this, records, index);
this.fireEvent('datachanged', this);
}

Jamie Avins
31 Aug 2010, 9:38 AM
DUPE: http://www.sencha.com/forum/showthread.php?107561-datachanged-event-not-fired-after-store.add()-store.insert()-(0.92