I'm trying to work through the sample http://help.arcgis.com/en/webapi/javascript/arcgis/demos/fl/fl_dgrid.html 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 row.data 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 = dojo.map(results.features, 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]]
}
});
window.grid.renderArray(data);
window.grid.sort('facility');
});
}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);
grid.clearSelection();
// dojo.forEach(states.graphics, function(g) {
for ( var i = 0; i < states.graphics.length; i++ ) {
var g = states.graphics;
var row = grid.row(g.attributes.OBJECTID);
// console.log("row is: ", row, row.data.featureId);
if ( row && row.data && row.data.featureId == id ) {
// grid.select(row);
selectRow(row.element);
row.element.scrollIntoView();
break;
}
};
}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?