Looking at the Query Widget, it looks like the query is just run the one time on the first load and results parsed and stored in queryResultAC. This is probably to save the time of having to rerun the query each time you close/open the widget.If you'd like to zoom the query results each time the widget is open, you can listen for the addedToStage event on something. I tried it out and added it to the QueryResultDataGroup<Query:QueryResultDataGroup id="queryResultDG" addedToStage="queryResultDG_addedToStageHandler(event)" ...Then do something like this. protected function queryResultDG_addedToStageHandler(event:Event):void { if (graphicsLayer) // need this because on first load, value is null map.extent = GraphicUtil.getGraphicsExtent(ArrayCollection(graphicsLayer.graphicProvider).toArray()); } That should get you started.
<Query:QueryResultDataGroup id="queryResultDG" addedToStage="queryResultDG_addedToStageHandler(event)" ...
protected function queryResultDG_addedToStageHandler(event:Event):void { if (graphicsLayer) // need this because on first load, value is null map.extent = GraphicUtil.getGraphicsExtent(ArrayCollection(graphicsLayer.graphicProvider).toArray()); }
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.