views:

89

answers:

0

How do I update dojox.Grid so it displays the latest data?

Initially I created the empty store, and then I changed the data to contain something, create a new data store with the new data and then set the grid datastore to the new store.

In most of the examples, people use url instead of data when they initialize the store.

So how do I update the 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);