AnsweredAssumed Answered

dgrid refresh

Question asked by mrogers83 on Feb 12, 2014
Latest reply on Feb 13, 2014 by mrogers83
I am working with a feature layer that refreshes every 5 seconds.  I would like my dgrid to refresh also, so it is giving the most up-to-date information.  I have tried inserting the code: grid.refresh(0.083); in many places throughout my code, but the grid is not updating at all.  I am using a memory store, could this have something to do with why my grid won't refresh?  The code I am using to populate the grid is as follows:

function populateGrid(Memory) {             [INDENT]var qt = new QueryTask(window.unitsUrl);             var query = new Query();            [/INDENT]  query.where = "1=1";              query.returnGeometry = false;              query.outFields = window.outFields;              qt.execute(query, function(results) {   var data = [];   var data =, function(feature) {                    return {                       // property names used here match those used when creating the dgrid                       "id": feature.attributes[window.outFields[0]],                       "vehicleId": feature.attributes[window.outFields[1]],                       "velocity": feature.attributes[window.outFields[2]],     "timestamp": feature.attributes[window.outFields[3]]    }                 });   //if (!grid) {    //grid = new Grid({     //columns: {      //"id": "ID",                    //"vehicleId": "Vehicle ID",                    //"velocity": { "label": "Speed (MPH)", "formatter": dojoNum.format },      //"timestamp": "Time Stamp"     //}    //}, "grid");   //}   //grid.refresh(0.083);               var memStore = new Memory({ data: data });                 window.grid.set("store", memStore);  }); }

Also, the code where I am calling that function is as follows:

map.on("load", function( evt ){              // show the border container now that the dijits               // are rendered and the map has loaded              domStyle.set(registry.byId("container").domNode, "visibility", "visible");              populateGrid(Memory); // pass a reference to the MemoryStore constructor         });

Any help in getting this to refresh is greatly appreciated.