View Full Version : Grid insert row problem

16 Feb 2011, 12:33 AM

Would anyone be able to help with this? I have created a grid to insert/update/delete rows. It works fine mostly but there is an issue with the insert. After clicking the add button, and firing the store.insert(0,t) and it has inserted the row into the database successfully. However, when I go to another record and the update it, the update event fires for the updated record, but it also fires the insert once again, causing the database to have multiple inserts of this new record. I have the autoSave set to true on the store.

What are the options to fix this? Or is there a way that after inserting a record, that the row on the grid is updated with the newly inserted record so that it will not run the insert() method again and insert duplicated records?

Below is my code for inserting the row:

* onAdd
onAdd: function (btn, ev) {
var t = new this.store.recordType({
Task: 'New Task',
TaskDate: (new Date()).clearTime(),
Completed: false
this.store.insert(0, t);
this.startEditing(0, 1);