How to add records in json-store ?? Using ExtJS

You need to define a record type, create it and at it, e.g:

 

TaskLocation = Ext.data.Record.create([

{name: "id", type: "string"},

{name: "type", type: "string"},

{name: "type_data", type: "string"},

{name: "display_value", type: "string"}

]);

 

Then:

 

var record = new TaskLocation({

id: Ext.id(),

type: "city",

type_data: "",

display_value: "Brighton"

});

 

Then:

 

my_store.add(record);

my_store.commitChanges();

 

Remember by the time the data is in the store it's not in the same format as you sent it down but in Record objects instead.

 原始文章出處 : http://stackoverflow.com/questions/3405437/how-to-add-records-in-json-store


arrow
arrow
    文章標籤
    Extjs store.add store record
    全站熱搜

    Frank 發表在 痞客邦 留言(0) 人氣()