PDA

View Full Version : [CLOSED] JavaScript error in rejectChanges() method in Ext.NET's Store override



anup
Jun 05, 2012, 3:30 AM
I am getting a JavaScript error when calling a Store's rejectChanges() method, saying "me" is not defined.

This looks to be the relevant bit of code. I think "me = this" just needs to be added to the variable declarations, or maybe just use this?



rejectChanges : function (actions) {
var i,
len,
records,
record;

actions = Ext.apply({
create : true,
update : true,
destroy : true
}, actions || {});

if (actions.create) {
records = me.getNewRecords();
len = records.length;

if (len > 0) {
for (i = 0; i < len; i++) {
record = records[i];
this.remove(record, true);
}
}
}

if (actions.update) {
records = me.getUpdatedRecords();
len = records.length;

if (len > 0) {
for (i = 0; i < len; i++) {
record = records[i];
record.reject();
}
}
}

if (actions.destroy) {
records = me.getRemovedRecords();
len = records.length;

if (records.length > 0) {
var autoSync = this.autoSync;
this.autoSync = false;
this.add(records);
this.autoSync = autoSync;
this.removed = [];
}
}
},


Hope that helps.

Daniil
Jun 05, 2012, 1:33 PM
Hi Anup,

Thanks for the report! Fixed in SVN, revision #4072.

anup
Jun 06, 2012, 8:27 PM
Thanks for the fix. Looks good; you can mark as closed.