AnsweredAssumed Answered

dgrid not populated with Memory - querytask results

Question asked by schlot on Oct 28, 2013
Latest reply on Oct 30, 2013 by kenbuja
I have found multiple threads about populating a dgrid from results of a query task, but I still can't figure out what is wrong with the way I have my dGrid and Memory created. 

I have multiple queries getting executed, and each of the query results will be put in a separate Title Pane within a Floating Pane.  The title panes are getting created and I see that my Memory is populated, but I must not have this formatted correctly, because when I use it as the store for my dGrid, I get an empty grid.  The loop that reads the attribute names to create the columns look right.
function queryGeometryResultsHandler_toGrid(results, idx) { //format the data for the data grid var dataList = {}; =, function(feature){              return feature.attributes;     });     var currentMemory = new Memory({, idProperty:'OBJECTID'});      var gridcolumns = [];          for (attName in[0]) {             if (attName != "Shape" && attName !== "Shape.area" && attName !== "Shape.len") {                 var objects = {};                 objects.label = attName;                 objects.field = attName;                 gridcolumns.push(objects);             }         }  //create a titlePane in the floatingPane for each visible layer     var currentLayerId = qTaskNameList[idx];//a list of layers created in query task functions     var paneTitle = (currentLayerId.split('_').join(' '))+"  ("+results.features.length+")";//formats string to look nice     tp = new TitlePane({ id: 'gridPane_'+currentLayerId, title: paneTitle, splitter:true, class:'reportTitlePane'});     registry.byId("reportContainer").addChild(tp);     tp.startup();  // Create Grid using structure and data defined above     grid = new Grid({id:currentLayerId+'_grid', autoHeight:true, columns:gridcolumns, store:currentMemory} ); //dgrid              grid.startup();            if (results.features.length > 0) {            tp.set("content", grid);         }else {             tp.set("content", "No features found");         }     }

I had this working in non-AMD style, but there I was using ItemFileReadStore and Dojox.Grid.DataGrid, so I know my theory is basically sound, just not the syntax.

Here's a link.  You have to turn on some layer other than legislative districts, like schools,  and then enter a district number to initiate the query.