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 = array.map(results.features, 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); }); }
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 });
Solved! Go to Solution.
That was the ticket! My grid is finally refreshing, thanks! I did end up having to still call the request because when I zoomed in to one point, the grid only had the one point in it. By making another request with the Query and QueryTask, I was able to zoom, but still have all vehicles on the list.
Do you know if there's a way to sort the grid on one field?
Also, when I zoom, the feature layer stops refreshing, but the grid still does. Is there something in my code that is causing the feature layer to stop refreshing when it zooms?