<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ZoomTo Object in DataGrid Table in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/zoomto-object-in-datagrid-table/m-p/251779#M6002</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm assuming that you are populating the DataGrid.dataProvider with QueryTask.executeLastResult.attributes and the features on the map are on a GraphicsLayer with the graphicProvider populated by QueryTask.executeLastResult.features. If that's the case, in the itemClick handler you can loop through and try to match some unique ID in the features with a unique ID of the attribute clicked on in the DataGrid, like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for each(var feature:Graphic in queryTask.executeLastResult.features)
{
 if(feature.attributes.ID== event.itemRenderer.data.ID)
 {
&amp;nbsp; myMap.extent = feature.geometry.extent;
 }
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 12:29:06 GMT</pubDate>
    <dc:creator>GadyPitaru</dc:creator>
    <dc:date>2021-12-11T12:29:06Z</dc:date>
    <item>
      <title>ZoomTo Object in DataGrid Table</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/zoomto-object-in-datagrid-table/m-p/251778#M6001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have an item in a datagrid table and I'm trying to use the itemClick event to zoom-in to each item on the map when clicked on the item. Has anyone worked similar proejct? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;var myGra:ArrayCollection = myGraphicsLayer.myGra as ArrayCollection;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var myGraExt:Extent = GraphicUtil.getGraphicsExtent(myGra.toArray());
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myMap.extent = myGraExt.expand(2.4);&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, this approach from esri samples zooms to all features instead of each individual item.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 12 Nov 2010 18:31:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/zoomto-object-in-datagrid-table/m-p/251778#M6001</guid>
      <dc:creator>DidumAbraham</dc:creator>
      <dc:date>2010-11-12T18:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: ZoomTo Object in DataGrid Table</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/zoomto-object-in-datagrid-table/m-p/251779#M6002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm assuming that you are populating the DataGrid.dataProvider with QueryTask.executeLastResult.attributes and the features on the map are on a GraphicsLayer with the graphicProvider populated by QueryTask.executeLastResult.features. If that's the case, in the itemClick handler you can loop through and try to match some unique ID in the features with a unique ID of the attribute clicked on in the DataGrid, like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for each(var feature:Graphic in queryTask.executeLastResult.features)
{
 if(feature.attributes.ID== event.itemRenderer.data.ID)
 {
&amp;nbsp; myMap.extent = feature.geometry.extent;
 }
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:29:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/zoomto-object-in-datagrid-table/m-p/251779#M6002</guid>
      <dc:creator>GadyPitaru</dc:creator>
      <dc:date>2021-12-11T12:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: ZoomTo Object in DataGrid Table</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/zoomto-object-in-datagrid-table/m-p/251780#M6003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm not using QueryTask.executeLastResult.attributes, but I am using findTask. Here is sample code...&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;private function doFind():void {
 var FindParams:FindParameters = new FindParameters();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FindParams.contains = true;
 FindParams.layerIds = [0];
 FindParams.outSpatialReference = myMap.spatialReference;
 FindParams.returnGeometry = true;
 FindParams.searchFields = ["*"];
 FindParams.searchText = findTxt.text;
 findTask.execute(FindParams);&amp;nbsp; //
&amp;lt;!-- Find Tasks --&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;esri:FindTask id="findTask" showBusyCursor="true" 
 executeComplete="{findHandler(event);}"
 url="rest/api/server..."/&amp;gt;
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;private function findHandler(event:FindEvent):void {
 myGraphicsLayer.clear();&amp;nbsp; 
 //resultSummary.text = "Results found: " + event.findResults.length;&amp;nbsp; 
 myGraphicsLayer.symbol = sfsFind;
 var resultCount:int = event.findResults.length;
 if (resultCount == 0) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Alert.show("Search not found. \nPlease select the correct \nradio button and retry!");
 } else {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var myFeatures:ArrayCollection = new ArrayCollection();
&amp;nbsp; for(var k:int=0; k &amp;lt; resultCount; k++){ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var cntr2:Number = (k+1);
&amp;nbsp;&amp;nbsp; bottomPanel.title = "Length of features : " + resultCount.toString();
&amp;nbsp;&amp;nbsp; myFeatures.addItem(
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp; COUNT: cntr2,
&amp;nbsp; YEAR_BUILT: FindResult(event.findResults&lt;K&gt;).feature.attributes.YEAR_BUILT,
&amp;nbsp; UKEY: FindResult(event.findResults&lt;K&gt;).feature.attributes.UKEY,&amp;nbsp;&amp;nbsp;&amp;nbsp; ADDRESS1: FindResult(event.findResults&lt;K&gt;).feature.attributes.ADDRESS1
&amp;nbsp;&amp;nbsp; }
&amp;nbsp; );
&amp;nbsp; myGrid.visible = true;
&amp;nbsp; myGrid.dataProvider = myFeatures;
&amp;nbsp; }

&amp;lt;mx:DataGrid id="myGrid" visible="false" width="100%" color="0x006699"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; itemClick="myGrid_itemClick(event)" editable="false"&amp;gt;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;mx:columns&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;mx:DataGridColumn width="40" dataField="COUNT" headerText="#"/&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;mx:DataGridColumn width="45" dataField="YEAR_BUILT" headerText="Year"/&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;mx:DataGridColumn width="45" dataField="UKEY" headerText="Key"/&amp;gt;
&amp;lt;mx:DataGridColumn dataField="ADDRESS1" headerText="City Name"/&amp;gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/mx:columns&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/mx:DataGrid&amp;gt;
&lt;/K&gt;&lt;/K&gt;&lt;/K&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;private function myGrid_itemClick(event:ListEvent):void {&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; if(event.columnIndex &amp;gt;= 0){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var graphicProvider:ArrayCollection = myGraphicsLayer.graphicProvider as ArrayCollection;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var graphicsExtent:Extent = GraphicUtil.getGraphicsExtent(graphicProvider.toArray());
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myMap.extent = graphicsExtent.expand(2.4);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myGraphicsLayer.symbol = smsFind;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp; }&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:29:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/zoomto-object-in-datagrid-table/m-p/251780#M6003</guid>
      <dc:creator>DidumAbraham</dc:creator>
      <dc:date>2021-12-11T12:29:09Z</dc:date>
    </item>
  </channel>
</rss>

