hi
if you did the zoom to search result , pleas share it . i need to do some like that.
Thanks
I haven't succeed yet findTask = new esri.tasks.FindTask("http://localhost:6080/arcgis/rest/services/FC/AapInfo/MapServer");
dojo.connect(map, "onLoad", function() {
findParams = new esri.tasks.FindParameters();
findParams.returnGeometry = true;
findParams.layerIds = [2];
findParams.searchFields = ["OBJECTID","Number","Abbrev","CampusCode"];
findParams.outSpatialReference = map.spatialReference;
console.log("find sr: ", findParams.outSpatialReference);
});
function doFind() {
findParams.searchText = dojo.byId("searchField").value;
findTask.execute(findParams,showResults);
}
function showResults(results) {
map.graphics.clear();
var symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([98,194,204]), 2), new dojo.Color([98,194,204,0.5]));
var items = dojo.map(results,function(result){
var graphic = result.feature;
graphic.setSymbol(symbol);
map.graphics.add(graphic);
return result.feature.attributes;
});
var data = {
identifier: "OBJECTID",
label: "OBJECTID",
items: items
};
store = new dojo.data.ItemFileReadStore({ data:data });
grid.setStore(store);
map.centerAndZoom(center, zoom);
}
function onRowClickHandler(evt){
var clickedTaxLotId = grid.getItem(evt.rowIndex).OBJECTID;
var selectedTaxLot;
dojo.forEach(map.graphics.graphics,function(graphic){
if((graphic.attributes) && graphic.attributes.OBJECTID === clickedTaxLotId){
selectedTaxLot = graphic;
//alert(selectedTaxLot);
return;
}
});
var taxLotExtent = selectedTaxLot.geometry.getExtent();
map.setExtent(taxLotExtent);
}
<input type="text" id="searchField" size="30" value="" /><button data-dojo-type="dijit.form.Button" onClick="doFind();" value="Search">
Search
</button>
<table data-dojo-type="dojox.grid.DataGrid" data-dojo-id="grid" id="grid" data-dojo-props="rowsPerPage:'5', rowSelector:'10px'">
<thead>
<tr>
<th field="Number" width="50">Num</th>
<th field="Abbrev" width="50">Abbr</th>
<th field="CampusCode" width="50">Camp</th>
</tr>
</thead>
</table>
All i can get is result highlighted on the map but no return on "dojo grid " at the <table>if someone knows why please HELP!