<?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: Fire Datagrid item_click event in ArcGIS Viewer for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/fire-datagrid-item-click-event/m-p/303170#M8939</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rebecca,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Is your detailGrid receiving the event and just failing because of some condition in your eventhandler? Have you put a trace in the detailGrid event handler? Working with programmatic event firing can be difficult. Have you just considered an additional function that the one result in the identify would call to populate the detailGrid?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Aug 2014 15:25:44 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2014-08-27T15:25:44Z</dc:date>
    <item>
      <title>Fire Datagrid item_click event</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/fire-datagrid-item-click-event/m-p/303169#M8938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;I'm having some issues getting an event to fire programmatically. I have two datagrids. I execute an identifyTask from a click on the map and populate myGrid with the results. When I click on a record in myGrid, the dataGridClickEvent function is run which populates detailGrid with more detailed information. This all runs fine, but I would like it so that if there is only one result from the identifyTask, the dataGridClickEvent function runs automatically to populate detailGrid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the code I am using, but detailGrid is still not being populated unless I physically click on the record in myGrid.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;EM style=": ; color: #009900; font-size: 10pt;"&gt;//ArrayCollection for my results &lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;initDG = &lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG style="color: #0033ff; font-size: 10pt;"&gt;&lt;STRONG style="color: #0033ff; font-size: 10pt;"&gt;new&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; ArrayCollection(DGArray);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;EM style=": ; color: #009900; font-size: 10pt;"&gt;//if the ArrayCollect has only one result&lt;/EM&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG style="color: #0033ff; font-size: 10pt;"&gt;&lt;STRONG style="color: #0033ff; font-size: 10pt;"&gt;if&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; (initDG.length == 1)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;{&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;myGrid.dispatchEvent(&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG style="color: #0033ff; font-size: 10pt;"&gt;&lt;STRONG style="color: #0033ff; font-size: 10pt;"&gt;new&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; ListEvent(ListEvent.ITEM_CLICK, &lt;/SPAN&gt;&lt;STRONG style="color: #0033ff; font-size: 10pt;"&gt;&lt;STRONG style="color: #0033ff; font-size: 10pt;"&gt;false&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt;, &lt;/SPAN&gt;&lt;STRONG style="color: #0033ff; font-size: 10pt;"&gt;&lt;STRONG style="color: #0033ff; font-size: 10pt;"&gt;false&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt;,0,0));&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have also tried:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dataGridClickEvent(&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG style="color: #0033ff; font-size: 10pt;"&gt;&lt;STRONG style="color: #0033ff; font-size: 10pt;"&gt;new&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; ListEvent(ListEvent.ITEM_CLICK, &lt;/SPAN&gt;&lt;STRONG style="color: #0033ff; font-size: 10pt;"&gt;&lt;STRONG style="color: #0033ff; font-size: 10pt;"&gt;false&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt;, &lt;/SPAN&gt;&lt;STRONG style="color: #0033ff; font-size: 10pt;"&gt;&lt;STRONG style="color: #0033ff; font-size: 10pt;"&gt;false&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt;"&gt; ,0,0));&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone tell me where I am going wrong?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Aug 2014 15:14:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/fire-datagrid-item-click-event/m-p/303169#M8938</guid>
      <dc:creator>RebeccaWatson</dc:creator>
      <dc:date>2014-08-27T15:14:00Z</dc:date>
    </item>
    <item>
      <title>Re: Fire Datagrid item_click event</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/fire-datagrid-item-click-event/m-p/303170#M8939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rebecca,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Is your detailGrid receiving the event and just failing because of some condition in your eventhandler? Have you put a trace in the detailGrid event handler? Working with programmatic event firing can be difficult. Have you just considered an additional function that the one result in the identify would call to populate the detailGrid?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Aug 2014 15:25:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/fire-datagrid-item-click-event/m-p/303170#M8939</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2014-08-27T15:25:44Z</dc:date>
    </item>
    <item>
      <title>Re: Fire Datagrid item_click event</title>
      <link>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/fire-datagrid-item-click-event/m-p/303171#M8940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Thank you Robert. I thought that I must be doing the event firing wrong so I didn't look closely enough at what the dataGridClickEvent handler was doing. The event is firing, but the dataGridClickEvent function uses event.currentTarget.selectedItem to ascertain which discipline the results are for and then shows a selection of attributes that are relevant to that discipline. When I fire the event programmatically, the event.currentTarget doesn't seem to be set so the discipline variable and all the attributes were not being assigned. So I have added myGrid.selectedIndex = 0;&amp;nbsp; into the if statement (shown in my first post) and changed my dataGridClickEvent function as follows and it seems to have done the trick:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0033ff; font-size: 10pt;"&gt;&lt;STRONG style="color: #0033ff; font-size: 10pt;"&gt;&lt;STRONG&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;private &lt;SPAN style="color: #339966; font-size: 10pt;"&gt;&lt;STRONG&gt;&lt;STRONG&gt;function &lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;dataGridClickEvent(event:ListEvent):&lt;/SPAN&gt;&lt;SPAN style="color: #0033ff; font-size: 10pt;"&gt;&lt;STRONG&gt;void&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;{&lt;/P&gt;&lt;P align="left"&gt;// var discipline was being assigned like this&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;// var discipline:String = event.currentTarget.selectedItem.Disc;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;//now it's being assigned like this&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #6699cc; font-size: 10pt;"&gt;&lt;STRONG&gt;&lt;STRONG&gt;var&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; discipline:String = myGrid.selectedItem.Disc;&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;P&gt;aMap = &lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #0033ff; font-size: 10pt;"&gt;&lt;STRONG&gt;&lt;STRONG&gt;new&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; Object();&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;dpArray = &lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #0033ff; font-size: 10pt;"&gt;&lt;STRONG&gt;&lt;STRONG&gt;new&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; Array();&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #0033ff; font-size: 10pt;"&gt;&lt;STRONG&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; switch&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;(discipline)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #0033ff; font-size: 10pt;"&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;SPAN style="color: #0033ff; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; case&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #990000; font-size: 10pt;"&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;SPAN style="color: #990000; font-size: 10pt;"&gt;"Water&lt;/SPAN&gt;"&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // attributes were being assigned like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //aMap[&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #990000; font-size: 10pt;"&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;SPAN style="color: #990000; font-size: 10pt;"&gt;"Location&lt;/SPAN&gt;"&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;] = event.currentTarget.selectedItem.Loc;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // now attributes are being assigned like this&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aMap[&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #990000; font-size: 10pt;"&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;SPAN style="color: #990000; font-size: 10pt;"&gt;"Location&lt;/SPAN&gt;"&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;] = myGrid.selectedItem.Loc;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //then numerous other attributes are assigned&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for &lt;SPAN style="font-size: 10pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #6699cc; font-size: 10pt;"&gt;&lt;STRONG&gt;&lt;STRONG&gt;var &lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;pkey:String &lt;/SPAN&gt;&lt;SPAN style="color: #0033ff; font-size: 10pt;"&gt;&lt;STRONG&gt;&lt;STRONG&gt;in &lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;aMap)&lt;/SPAN&gt;&lt;/P&gt;&lt;P align="left"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P align="left"&gt;&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; dpArray.push({label:pkey, data:aMap[pkey]});&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; initDP = &lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #0033ff; font-size: 10pt;"&gt;&lt;STRONG&gt;&lt;STRONG&gt;new&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt; ArrayCollection(dpArray);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;SPAN style="color: #0033ff; font-size: 10pt;"&gt;&lt;STRONG&gt;&lt;STRONG&gt;break&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;//etc for the other disciplines&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for pointing me in the right direction again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Aug 2014 15:21:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-viewer-for-flex-questions/fire-datagrid-item-click-event/m-p/303171#M8940</guid>
      <dc:creator>RebeccaWatson</dc:creator>
      <dc:date>2014-08-28T15:21:52Z</dc:date>
    </item>
  </channel>
</rss>

