AnsweredAssumed Answered

dgrid displays but does not populate with query results

Question asked by derekwaynemiller on Oct 26, 2012
Latest reply on Oct 29, 2012 by geos_rfleet
Hello all,

I'm having trouble populating a dgrid. The grid draws and the query in the function to populate the grid returns an array of features from the service (written to the console), but the data does not populate the dgrid. I'm receiving no errors, and my code is very similar to an example from Kelly Hutchins that I had found in the past, but couldn't find today. Anyone have any luck with a dgrid? It would be a very nice feature to implement.

Thanks in advance for any thoughts.

Code snippets below, the full file is attached.
- derek

 require(["dgrid/Grid", "dgrid/Selection", "dojo/store/Memory", "esri/Map", "esri/layers/FeatureLayer", "esri/dijit/InfoWindow", "esri/dijit/Popup", "esri/tasks/locator", "esri/tasks/query", "esri/symbol", "esri/Renderer", "dojo/_base/declare", "dojo/number", "dojo/parser", "dojo/dom", "dojo/query", "dojo/domReady!"],       function(Grid, Selection, Memory, Map, FeatureLayer, InfoWindow, Popup, Locator, Query, Symbol, Renderer, declare, dojoNum, parser, dom, query) {         //parse the script call and the dijits         parser.parse();                  //create the dgrid         window.grid = new (declare([Grid, Selection]))({           bufferRows: Infinity,           columns: {             "globalID": "ID",             "building_name": "name"           }         }, "grid");         grid.on(".field-building_name:click", selectProject);  // universal utility to resize the map div when the browser re-sizes         dojo.connect(map, "onLoad", function(map) {           //resize the map when the browser resizes           dojo.connect(dijit.byId("map"), "resize", map, map.resize);           // show the border container now that the dijits            // are rendered and the map has loaded "container").domNode, "visibility", "visible");           populateGrid(Memory);         });          //the following curly brace and closing parentheses are the end of the dojo/domReady! function         }   );   //end of the dojo/domReady! function         function populateGrid(Memory) {     console.log("in populateGrid");     var qt = new esri.tasks.QueryTask(window.gdaUrl);     var query = new esri.tasks.Query();     query.where = "1=1";     query.returnGeometry = false;     query.outFields = window.outFields;     qt.execute(query, function(results) {       console.log(results);       var data =, function(feature) {         return {           "globalID": feature.attributes[window.outFields[50]],           "building_name": feature.attributes[window.outFields[1]]         }       });       var memStore = new Memory({ data: data });       window.grid.set("store", memStore);       //window.grid.renderArray(data);       console.log("populateGrid is complete")     });   }   </script>