gridNoColumnSets.set("columnSets", columnExample1);
//gridNoColumnSets.set("columnSets", columnExample2);
function selectState(e) {
// select the feature
var fl = app.map.getLayer("NAME");
var features = fl.getSelectedFeatures();
var symbol = fl.getSelectionSymbol();
var id = parseInt(e.target.innerHTML);
var selectedGraphic;
arrayUtils.forEach(features, function(feature){
if(feature.attributes.OBJECTID === id){
selectedGraphic = feature;
}
feature.setSymbol(symbol);
});
var mySymbol = new SimpleMarkerSymbol().setOutline(null).setColor("#AEC7E3");
selectedGraphic.setSymbol(mySymbol);
app.map.centerAt(selectedGraphic.geometry.getExtent().getCenter());
}
query.objectIds = [parseInt(e.target.innerHTML)];
var columnExample2 = [
[
[
{label: 'id', field: 'id', sortable: false,
formatter: function () {
return '<img src="images/marker.png"/>';
},
get: function (object) {
return object["id"];
}
},
{label: 'access', field: 'ACCESSAREA'}
],
[
{label: 'location', field: 'LOCATION', colSpan: 2, sortable: false}
]
],
];
query.objectIds = [parseInt(e.target.innerHTML)];
dataGrid.on(".dgrid-row:click", gridSelect);
dataGrid.on("show", function () {
dataGrid.resize();
});
dataGrid.on(mouseUtil.enterRow, gridEnter);
//this highlights the graphic
function gridEnter(e) {
map.graphics.clear();
var gridId = e.currentTarget.id;
var selectedGrid = dijit.byId(gridId);
var row = selectedGrid.row(e);
graphicHighlight = findGraphicByAttribute(row.data);
if (graphicHighlight !== null) {
switch (graphicHighlight.geometry.type) {
case "point": case "multipoint":
map.graphics.add(new esri.Graphic(graphicHighlight.geometry, symbolHighlightPoint));
break;
case "polyline":
map.graphics.add(new esri.Graphic(graphicHighlight.geometry, symbolHighlightPolyline));
break;
case "polygon": case "extent":
map.graphics.add(new esri.Graphic(graphicHighlight.geometry, symbolHighlightPolygon));
break;
}
}
}
//this "flashes" the graphic
function gridSelect(e) {
var graphicFlash;
var gridId = e.currentTarget.id;
var selectedGrid = dijit.byId(gridId);
var row = selectedGrid.row(e);
graphicHighlight = findGraphicByAttribute(row.data);
if (graphicHighlight !== null) {
switch (graphicHighlight.geometry.type) {
case "point": case "multipoint":
graphicFlash = new esri.Graphic(graphicHighlight.geometry, symbolFlashPoint)
break;
case "polyline":
graphicFlash = new esri.Graphic(graphicHighlight.geometry, symbolFlashPolyline);
break;
case "polygon": case "extent":
graphicFlash = new esri.Graphic(graphicHighlight.geometry, symbolFlashPolygon);
break;
}
map.graphics.add(graphicFlash);
}
var shape = graphicFlash.getDojoShape();
var animStroke = fx.animateStroke({
shape: shape,
duration: 500,
color: { end: new dojo.Color([0, 0, 0, 0]) }
});
var animFill = fx.animateFill({
shape: shape,
duration: 500,
color: { end: new dojo.Color([0, 0, 0, 0]) }
});
var anim = dojo.fx.combine([animStroke, animFill]).play();
var animConnect = dojo.connect(anim, "onEnd", function () {
map.graphics.remove(graphicFlash);
});
}
function findGraphicByAttribute(attributes) {
for (i = 0; i < layerResultsGraphic.graphics.length; i++) {
if (JSON.stringify(layerResultsGraphic.graphics.attributes) === JSON.stringify(attributes)) { return layerResultsGraphic.graphics; }
}
return null;
}
Jay, I am trying to help you as best I can without actually doing your work for you.
Please reread my previous posts to find the answer to your question.
What does e.target.innerHTML equal in this last sample?
var id1 = parseInt(e.currentTarget.id)
var id1 = e.currentTarget.id;
var gridId = e.currentTarget.id; var selectedGrid = dijit.byId(gridId); alert(selectedGrid);
function selectState(e) {
alert("select the feature");
var fl = app.map.getLayer("NAME");
var features = fl.getSelectedFeatures();
var symbol1 = fl.getSelectionSymbol();
var id1 = parseInt(e.currentTarget.id);
var selectedGraphic1;
arrayUtils.forEach(features, function(feature){
if(feature.attributes.OBJECTID === id1){
selectedGraphic1 = feature;
}
feature.setSymbol(symbol1);
});
var mySymbol1 = new SimpleMarkerSymbol().setOutline(null).setColor("#AEC7E3");
selectedGraphic1.setSymbol(mySymbol1);
app.map.centerAt(selectedGraphic1.geometry.getExtent().getCenter());
}