I've created a web app with a find task within it. All works well but what i would like to do is get the FIND task to remove any exisitng find queries from the map and then zoom out to full extent, displaying the new finds OR better still, zoom to the new finds. Did start out using the datagrid sample but didnt quiet like it.
Below is a copy of my JS and html - any suggestions?
//create find parameters and define known values findParams = new esri.tasks.FindParameters(); findParams.returnGeometry = true; findParams.layerIds = [0]; findParams.searchFields = ["ADDRESS"];
}
function execute(searchText) { //set the search text to find parameters findParams.searchText = searchText; findTask.execute(findParams, showResults); }
function showResults(results) { //symbology for graphics var markerSymbol = new esri.symbol.PictureMarkerSymbol('images/pushpin.png', 25, 25);
//find results return an array of findResult. map.graphics.clear(); var dataForGrid = []; //Build an array of attribute information and add each found graphic to the map dojo.forEach(results, function (result) { var graphic = result.feature; dataForGrid.push([result.layerName, result.foundFieldName, result.value]); switch (graphic.geometry.type) { case "point": graphic.setSymbol(markerSymbol); break; } map.graphics.add(graphic); }); var data = { items: dataForGrid }; var store = new dojo.data.ItemFileReadStore({ data: data }); grid.setStore(store); } dojo.addOnLoad(init);