AnsweredAssumed Answered

problems with featureLayer tied to dGrid example

Question asked by schlot on Jul 3, 2012
Latest reply on Nov 16, 2012 by brumm1dj
I'm trying to work through the sample  that ties a feature layer to the new dgrid.  It works fine for me with polygons, but I can't seem to get this to work with points. The featurelayer draws fine.  The grid populates just fine.  In the selectGrid function when I debug, the row variable has a null for both its data and its element.  It does have an ID number which looks to be OBJECTID.

In the grid, where are and row.element coming from?  I assume somehow assigned in the populateGrid function?
Here's my populateGrid:
 function populateGrid() {
      var qt = new esri.tasks.QueryTask(window.statesUrl);
      var query = new esri.tasks.Query();
      query.where = "1=1";
      query.returnGeometry = false;
      query.outFields = window.outFields;
      qt.execute(query, function(results) {
        var data =, function(feature) {
          return {
            "featureId": feature.attributes[window.outFields[0]],
            "facility": feature.attributes[window.outFields[1]],
            "address": feature.attributes[window.outFields[2]],
            "city": feature.attributes[window.outFields[3]],
            "state": feature.attributes[window.outFields[4]]

Here's my selectGrid function:

function selectGrid(e) {
      console.log("fl click: ", e.graphic.attributes.OBJECTID);
      var id = e.graphic.attributes.OBJECTID;
      var query = new esri.tasks.Query();
      query.objectIds = [e.graphic.attributes.OBJECTID];
      var states = map.getLayer("points");
      states.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW);
      // dojo.forEach(, function(g) {
      for ( var i = 0; i <; i++ ) {
        var g =[i];
        var row = grid.row(g.attributes.OBJECTID);
        // console.log("row is: ", row,;
        if ( row && && == id ) {

When I put a breakpoint on the row variable, Firebug shows this as data undefined and element as null.  So the selectRow function that follows errors out.
When examing the query variable, I see it has a spatialRelationship of esriSpatialRelIntersects.  Is that where the problem is?  Do I need to define something different for the query since it's not a polygon?  I've not used a query.ObjectIds before.

My featureLayer does show that I have some selected features so I figure it's finding something, but maybe it's really not?