Zoomto FeatureLayer

Discussion created by aka2demo on Apr 29, 2013
Latest reply on May 3, 2013 by evtguy
I sort of had two questions regarding featurelayers, wanted to see if anyone could help me out.

First off, I'm trying to do a simple zoomto or set extent to a featurelayer with a setdefinitionexpression. I'm using the feature hover layer as a starting example: http://help.arcgis.com/en/webapi/javascript/arcgis/jssamples/fl_hover.html. However I'm not defining the map initial extent, I was hoping to define the extent of the map based on the specific state defined in the feature layers definitionexpression and zoom to the featurelayer extent. So, basically page would load to specific state, ex: State="Maryland" and map would zoom to the polygon maryland, without a table, any user input, or by defining specific map extent before hand as is done in the example above.

I was able to get something like this working using a specific set of coordinates I defined, then by passing those coordinates into a graphic, then resetting the map extent to read the graphic points. However,  I was trying to keep this simple and use a featurelayer from our ArcGIS Server. Does anyone have any recommendations for how to simply zoom to a feature layer polygon.

Second question I believe is a bit simpler, does the featurelayer setdefenitionexpression option only accept or read text variables. I would much rather use a integer field. Not sure if I have to modify the setdefenitionexpression in some manner for this.