PDA

View Full Version : Store with autosave - multiple records getting created



paulharv
2 May 2012, 6:15 AM
Hi,

I have a store (bound to an EditorGrid) with autoLoad:true

When I insert a new record and edit the first cell it saves and when the ajax call comes back it sets the id property of the record and the record's phantom property is set to false. All good.

The trouble I'm having is that if I edit the second cell BEFORE the first ajax call comes back, then to the store it is still a phantom record and it sends off another create ajax request - thus I end up with 2 rows in the backend.

I cannot be the first person to be dealing with this! Does anyone have the answer?!

Thanks

scottmartin
2 May 2012, 7:57 AM
I would suggest updating when the record/row is completely updated and not each cell.

Regards,
Scott

paulharv
2 May 2012, 8:10 AM
Thanks,

The thing is a regular use case is the creation of a new row and then data entry on only one cell of it. This does need to save.

This issue must impact anyone using autosave I would think...

Perhaps I'll need to force a manual save of a new row (by trapping the store's beforesave event) and allow updates of existing rows to proceed...doesn;t seem like I should have to though.