Dojo datagrid and itemfilereadstore
How do I update dojox.Grid to display the latest data?
I first created an empty store and then I changed the data to hide something, create a new data store with the new data and then set the grid store to the new store.
In most examples, people use URL instead of data when they initialize the store.
So how do I update my grid to display the latest store?
// Use empty grid,
var emptyData = { identifier: "UID_T", label: "UID_T", items: [] };
var lgaNameSelectionStore = new dojo.data.ItemFileReadStore({data: emptyData});
var lgaNameGridLayout = [
{name : "<span title='Agency'>Agency</span>", field : "AGENCY", width : "7em"},
{name : "<span title='Project Description'>Project Description</span>", field : "ProjectDes", width : "20em"},
{name : "<span title='Description'>Description</span>", field : "CTPPD_DESC", width : "12em", },
];
var lgaNameContainer = new dijit.layout.BorderContainer({
style: "width: 100%; height: 100%",
gutters: false,
design: "headline"
},"lgawinuid");
lgaNameGrid = new dojox.grid.DataGrid({
store: lgaNameSelectionStore,
region: "center",
structure: lgaNameGridLayout,
selectionMode: "none",
noDataMessage: "No results found."
});
lgaNameContainer.addChild(lgaNameGrid);
lgaNameContainer.startup();
//data is changed, so need to update the grid
var data3 = { identifier: "UID_T", label: "UID_T", items: [{"UID_T" : "I333","AGENCY" : "RTA","CTPPD_DESC" : "M5","ProjectDes" : "Filtration","location" : ""}]};
lgaNameSelectionStore = new dojo.data.ItemFileReadStore({data: data3});
lgaNameGrid.setStore(lgaNameSelectionStore);
+2
a source to share