Select to view content in your preferred language

zoom on parcel after a click on it in DataGrid

929
1
06-16-2010 05:31 AM
varnavarna
Emerging Contributor
Hello,

We are building an application with Flex and use the modified "Find Task and Zooming in to results" example to search for parcels and the results are displayed in a DataGrid on the right. The problem is that most of the times the results are more than 10-20 and it zooms in on half of the map (there is no other way to show all the found results). But the users will want to see a single result and that leads me to my question: Is there a way for the user to click on one of the FindTask results in the DataGrid and then the application to zoom in on that selected parcel?

Red some threads in the old forum but they all are about query and zoom and I'm not that skilled to rework the example to work with a click.


Thanks so much!
Deian Kiriazov
GIS Varna
Tags (2)
0 Kudos
1 Reply
varnavarna
Emerging Contributor
Hello,

I guess not alot of people have faced the problem with centering after a click in DataGrid. I've been searching for more info on the problem and foud this interesting thread:

http://forums.arcgis.com/threads/2047-Zoom-to-selected-row-of-DataGrid-in-QueryBuilderWidget-of-Flex...

There is a similarity in the tasks but in my case - no need for query identify after zooming to the clicked parcel and all the objects are polygons so no need to choose between polygon, point or polyline.

Tried to modify the code from the thread for my needs but nothing happens when I click on the DataGrid entries:

private function findGraphicByAttribute(attributes:Object):Graphic
{
    for each( var graphic:Graphic in myGraphicsLayer.graphicProvider)
    {
            if ( graphic.attributes === attributes)
            {
             return graphic;
            }
    }  
    return null;
}

private function onItemClick(event:ListEvent):void
{
  var gra:Graphic = findGraphicByAttribute(event.itemRenderer.data);
  var pt:MapPoint = null;
 
                pt = new MapPoint();   
         pt.x = (gra.geometry.extent.xmax + gra.geometry.extent.xmin) / 2
  pt.y = (gra.geometry.extent.ymax + gra.geometry.extent.ymin) / 2
          map.extent = gra.geometry.extent;
         }


Deian Kiriazov
GIS Varna
0 Kudos