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 dojo.style(dijit.byId("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 = dojo.map(results.features, 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>
Solved! Go to Solution.