欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

ExtJS Store的數(shù)據(jù)訪問與更新問題

 更新時(shí)間:2010年04月28日 19:22:37   作者:  
ExtJS Store的數(shù)據(jù)訪問與更新問題,需要的朋友可以參考下。
可以使用add(Ext.data.Record[] records)或者add(Ext.data.Record record)向store末尾添加一個(gè)或多個(gè)record。如:
復(fù)制代碼 代碼如下:
 
var newRecord=new PersonRecord({name:"Tom",age:22}); 
store.add(newRecord);

  add函數(shù)會(huì)將新的數(shù)據(jù)添加到store的末尾,這對(duì)其原有的排序方式可能造成破壞,如果希望保持有序,應(yīng)使用addSorted,調(diào)用方法與add相同。
  可以使用insert方法將記錄插入到指定的位置,如:
復(fù)制代碼 代碼如下:

var newRecord=new PersonRecord({name:"Tom",age:22});
store.insert(store.getCount(),newRecord);

  刪除操作可以使用remove和removeAll函數(shù),如:
復(fù)制代碼 代碼如下:

store.remove(store.getAt(0));
store.removeAll();

  修改store中的數(shù)據(jù):
復(fù)制代碼 代碼如下:

store.getAt(0).set("name","Jesse");

  修改record的內(nèi)部數(shù)據(jù)之后,可以通過(guò)執(zhí)行rejectChanges()來(lái)撤銷所有修改,或者通過(guò)commitChanges來(lái)提交數(shù)據(jù)修改。

相關(guān)文章

最新評(píng)論