leeby
18 Jul 2010, 4:07 AM
Hi,
See below red code, the "this.snapshot" and "this.data" is actually the same object, so the remove function will delete 2 records at the same time. The right record and the next record.
It can be solved by simply adding a 'IF'.
=========================
remove: function(record) {
if (Ext.isArray(record)) {
for (var i = 0, length = record.length; i < length; i++) {
this.remove(record[i]);
}
return;
}
this.removed.push(record);
var index = this.data.indexOf(record);
if (this.snapshot) {
this.snapshot.remove(record);
}
if (index > -1) {
record.unjoin(this);
this.data.removeAt(index);
this.fireEvent('remove', this, record, index);
this.fireEvent('datachanged', this);
}
}
See below red code, the "this.snapshot" and "this.data" is actually the same object, so the remove function will delete 2 records at the same time. The right record and the next record.
It can be solved by simply adding a 'IF'.
=========================
remove: function(record) {
if (Ext.isArray(record)) {
for (var i = 0, length = record.length; i < length; i++) {
this.remove(record[i]);
}
return;
}
this.removed.push(record);
var index = this.data.indexOf(record);
if (this.snapshot) {
this.snapshot.remove(record);
}
if (index > -1) {
record.unjoin(this);
this.data.removeAt(index);
this.fireEvent('remove', this, record, index);
this.fireEvent('datachanged', this);
}
}