Results 1 to 5 of 5

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

  1. #1
    Ext User
    Join Date
    Dec 2009
    Posts
    23
    Vote Rating
    0
      0  

    Default 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

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    118
      0  

    Default

    Call record.set(...) AFTER store.add(record).

  3. #3
    Ext User
    Join Date
    Dec 2009
    Posts
    23
    Vote Rating
    0
      0  

    Default

    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.
    Code:
    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)
    }
    after i check egrid.store.getModifiedRecords().length is 0

    thanks

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    118
      0  

    Default

    You are not calling record.set(...) as I recommended.

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

  5. #5
    Ext User
    Join Date
    Dec 2009
    Posts
    23
    Vote Rating
    0
      0  

    Default

    thanks it works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •