0

我有一个用ajax填充的网格,用户输入新数据并回调填充网格的ajax方法,我遇到的问题是网格是重复数据,我在升级网格之前尝试过填充一个空的strore但不起作用,

var gridColeccion = dijit.byId("colectionGrid");
var dummy = {items: []};
var newEventStoreColeccion = new dojo.data.ItemFileReadStore({clearOnClose:true,data:dummy});
newEventStoreColeccion.fetch();
gridColeccion.setStore(newEventStoreColeccion);
gridColeccion._refresh();


    folderConsult(token); // This metod fill the grid again

// 这是 folderConsult 中的部分代码;

  var datosColeccion = {
                items:    itemsColeccion
        };

 var gridColecccion = dijit.byId("colectionGrid");  
 nuevasColecciones= new dojo.data.ItemFileReadStore({clearOnClose:true,data: datosColeccion});
 nuevasColecciones.fetch();
 gridColecccion.setStore(nuevasColecciones);
 gridColecccion._refresh();

我希望有人可以帮助我,THX。

4

2 回答 2

1
while(grid.store._getItemsArray().length!=0)
{
   grid.store.deleteItem(grid.store._getItemsArray()[0]);
}
grid.store.save();
于 2012-09-06T11:31:12.380 回答
0

尝试使用nuevasColecciones.close()代替nuevasColecciones.fetch()并提供url参数而不是data参数。那应该会刷新商店中的数据,只要您已经发布了新数据,您就会得到所有的对象

于 2011-08-11T17:03:05.013 回答