AnsweredAssumed Answered

How to find a reference to each search result after I perform a search such that on clicking each reference/link, the map zooms in and an info template shows up for that result?

Question asked by MeghnaNatraj on Nov 15, 2015
Latest reply on Nov 16, 2015 by MeghnaNatraj

Though I have accomplished the task at hand, i wish to find a more efficient way to do this. If esri have provided a way to highlight the first search result on performing a search, why is there no way to highlight the second, third ..etc result? Why do i have to manually create an anchor tag to do this?

If there is a simpler way to perform this kindly let me know!


My Current method:

I am currently retrieving all the results after the search is complete in the following function and storing it in a global variable:


     //access and store in global variable  - allResults



For each of the data in allResults, I create a href link,  [<span class='link' onclick='searchTreeNum("+counter+");return false;'>] I zoom in and popUp the infoTemplate manually. This is done in the following function , where counter represents the index in the allResults that it must generate the popup for :


function searchTreeNum(counter){

            var feature = allResults[counter];




                var gs = new GeometryService(geometryLayerUrl);

                var bf = new BufferParameters();

                var p = new Point(feature.geometry.x,feature.geometry.y,feature.geometry.spatialReference);


                bf.geometries = [ feature.geometry ];

                bf.distances = [ 5 ];

                bf.unit = esri.tasks.GeometryService.UNIT_FEET;

                bf.spatialReference = feature.geometry.spatialReference;

                bf.outSpatialReference = map.spatialReference;

                gs.buffer(bf, function(bufResults) {


                  var g = new Graphic(bufResults[0], pointType2, feature.attributes, "");


                  var mp = webMercatorUtils.webMercatorToGeographic(p);