AnsweredAssumed Answered

Zoom to an extent on page load without clicking

Question asked by mrcoulson on Sep 20, 2012
Latest reply on Sep 20, 2012 by geos_rfleet
Salutations!

I am building a small application with this example:

http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/find_map_datagrid.html

Here's the link to what I have now:

http://www.co.frederick.va.us/dev/maps/test999.html?r=12345

In the example, a user performs a search and then clicks something in the grid to get the map to change its extent.  In my project, the search value, in this case called RECNUM, is fed to the application via the URL (see the ?r=12345) part.  Everything works as expected except that I want the map to zoom to that extent without the user needing to click in the grid (RECNUM is unique, so it should never return more than one result).  This is where I'm failing.  How can I use the following code without getting RECNUM via a click in the grid?

 function onRowClickHandler(evt){         var clickedTaxLotId = grid.getItem(evt.rowIndex).RECNUM;         var test = evt.rowIndex.toString();         alert(test);         var selectedTaxLot;          dojo.forEach(map.graphics.graphics,function(graphic){           if((graphic.attributes) && graphic.attributes.RECNUM === clickedTaxLotId){             selectedTaxLot = graphic;             return;           }         });         var taxLotExtent = selectedTaxLot.geometry.getExtent();         map.setExtent(taxLotExtent);


Any assistance is deeply appreciated.  This project is just one little step from being nearly finished (minus a few CSS tweaks).  Thanks!

Jeremy

Outcomes