开发者

How to clear a dojox.grid.DataGrid to Update the grid

开发者 https://www.devze.com 2023-03-26 21:33 出处:网络
I have a grid filled with ajax, the user enters new data and call back to the ajax method t开发者_开发问答hat fills the grid, the problem I have is that the grid are duplicate data, I have tried befor

I have a grid filled with ajax, the user enters new data and call back to the ajax method t开发者_开发问答hat fills the grid, the problem I have is that the grid are duplicate data, I have tried before upgrading the grid to fill with a empty strore but does not work,

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

// This is part of code in 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();

I hope someone can help me, THX.


while(grid.store._getItemsArray().length!=0)
{
   grid.store.deleteItem(grid.store._getItemsArray()[0]);
}
grid.store.save();


Try using nuevasColecciones.close() instead of nuevasColecciones.fetch() and provide a url param instead of the data param. That should refresh the data in the store, and as long as you have already posted the new data, you will get all of the objects back

0

精彩评论

暂无评论...
验证码 换一张
取 消