PDA

View Full Version : Edit store but not trigger writer to update proxy



RickardP
21 Jun 2010, 1:32 AM
I have a GroupingStore that i with this code editing a value:


var unitListGrouping = Ext.StoreMgr.lookup('unitListGrouping');
var rec = unitListGrouping.getById(record.get('Id'));
rec.beginEdit();
rec.set('Name', text);
rec.commit();

The same store i show data from in a GridPanel and i see in the GridPanel its has updated the value but i dont get it to run the JsonWriter i has set to the GroupingStore.

I have tried to run unitListGrouping.save() after commit the record and i has tested to set autosave to true.

I have read many examples that do the same thing but its not triggering the writer to update the proxy.

Someone has an idea why?

Condor
21 Jun 2010, 1:39 AM
1. beginEdit() should always be followed by endEdit() or cancelEdit(). You don't need to use beginEdit/endEdit if you only change a single field in the record.
2. Don't call commit() if you are planning to save() the record (if the save is successful it will be commited). endEdit() will automatically call save() if autoSave:true.

RickardP
21 Jun 2010, 1:45 AM
Thanks!

Sometimes maybe better to use the "community" then try to google stuff :P

Have been sitting with his like over 6 hours and you give me the answer in 7 minutes ;-)