View Full Version : add new record and set record data ,but use sore.modifited can't get new recods data

13 Jan 2010, 9:11 PM
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.



14 Jan 2010, 1:58 AM
Call record.set(...) AFTER store.add(record).

14 Jan 2010, 8:33 AM
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.

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

after i check egrid.store.getModifiedRecords().length is 0


14 Jan 2010, 8:43 AM
You are not calling record.set(...) as I recommended.

ps. You could also try calling record.afterEdit().

14 Jan 2010, 9:43 AM
thanks it works.