-
13 Jan 2010 9:11 PM #1
add new record and set record data ,but use sore.modifited can't get new recods data
add new record and set record data ,but use sore.modifited can't get new recods data
i want to add a new record in grid and save them into database.
record = new datarecord(.....)
i didn't run edit ,because my code data from other place. so i use record.set("xx","xx")
run store.addSorted(record) or store.add(record) or store.insert(0,record)
after i can saw the record in grid . i try to save them and use store.modifited get empty .
i turn to use store.getModifiedRecords() function also get empty.
any idea. i'm not sure it's a bug. or just i missing something.
thanks
xinfang
-
14 Jan 2010 1:58 AM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
Call record.set(...) AFTER store.add(record).
-
14 Jan 2010 8:33 AM #3
i did, you can see my post , i tired to use add,insert and addSotred function . after i uses firebug check store.data array has two new records. but in store.modifited ,it's empty []
in interface can saw tow new records , seems the add or addStored function which didn't call some function which add the new records into modifited array.
after i check egrid.store.getModifiedRecords().length is 0Code:if (record == null) { var defaultdata = { date: rows[i].get("date"), close: rows[i].get("close"), vol: rows[i].get("vol") }; var p = new egrid.store.recordType(defaultdata, recId); // create new record egrid.stopEditing(); egrid.store.add(p) }
thanks
-
14 Jan 2010 8:43 AM #4Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 41
You are not calling record.set(...) as I recommended.
ps. You could also try calling record.afterEdit().
-
14 Jan 2010 9:43 AM #5


Reply With Quote