AnsweredAssumed Answered

populate a dgrid with results of a querytask

Question asked by schlot on Sep 26, 2013
Latest reply on Sep 27, 2013 by schlot
I am running a querytask against a school layer and I need to be able to present the data in a dgrid with a rowrenderer.  I'm getting stuck formatting the data to populate the dgrid.  I'm new to the AMD format, I might not be using properly.   I commented out most of this, just to verify that my queryTask is executing. It is, but restoring the entire function, it fails, just firing my errorHandler instead.  The error comes back 'undefined', which is no help at all!

I'm pretty sure the problem is in the lines that define the variable 'data'.
function createSchoolList (results) {     var resultsLength = results.featureSet.features.length;     var data = [];     var schoolFeatures = results.featureSet.features;      if (dGridStacked) {         dGridStacked.refresh();     }      if (dGridTable) {         dGridTable.refresh();     }      data =, function(schoolFeatures){     return {         'facility': schoolFeatures.attributes[Facility],         'address': schoolFeatures.attributes[Address],         'city': schoolFeatures.attributes[City],              };    });     dGridStacked = new dgrid.Grid({         renderRow: renderRowFunction,         showHeader: true    }, "searchResultsGrid");          dGridStacked.startup();     dGridStacked.renderArray(data);     dGridStacked.sort('facility');      dGridStacked.on('.dgrid-row:click', function(event){       highlightGridSelection(event, dGridStacked);      });   console.log(data);       } function renderRowFunction (obj,options) {    var template = '<div class="title">${0}</div><div class="details">Address: ${1}</div> <div class="details">City: ${2}</div>';     return dojo.create("div",{        innerHTML : dojo.string.substitute(template,[obj.facility,obj.address,])       }); }