I'm using the Flexviewer 2.2 Query widget. I would like the map to zoom to the extent of the query results. I used the following code plugged into the "onResults" function of the widget:
{
var graphicsExtent:Extent = GraphicUtil.getGraphicsExtent(featureSet.features);
if (graphicsExtent)
{
map.extent = graphicsExtent.expand(2.0);
}
}
It works fine ONCE, but will not work for the same query again. After stepping around the code, it seems that query results are stored somewhere and the query is not rerun every time, so my little piece of code is not run again. I have tried moving the code around, clearing arrays, clearing graphics layers and still nothing. So, I come humbly before the masters seeking advice. Be gentle I'm new to programming, especially Flex.