views:

702

answers:

1

I'd like to have a double click event on a datagrid in Flex3. The following example only works if the Accordion (id = "mustBeSecond") container comes after the DataGrid. Why is the order of the components important and what can I do to prevent this behavior? (The example does not work. If you change the order of "mustBeSecond" and "gridReportConversions" the example works fine)

<mx:Script>
    <![CDATA[
            import mx.controls.Alert;
            import mx.collections.ArrayCollection;

            [Bindable] private var dp:ArrayCollection = new ArrayCollection([
                {qty:1,referer:'http://google.com'},
                {qty:25,referer:'http://cnn.com'},
                {qty:4,referer:'http:stackoverflow.com'}]);

            private function refererRowDoubleClicked(e:Event):void { 
                Alert.show("double click");
            }

    ]]>
</mx:Script>


<mx:HBox width="100%" height="100%"> 
  <mx:Accordion width="200" height="200" id="mustBeSecond">
    <mx:Canvas label="Navigation Box" width="100%" height="100%">
        <mx:VBox>
            <mx:LinkButton label="First Link" />
            <mx:LinkButton label="Second Link" />
        </mx:VBox>
    </mx:Canvas>
  </mx:Accordion>                   
  <mx:DataGrid id="gridReportConversions" height="100%" width="100%" dataProvider="{this.dp}"
    mouseEnabled="true" doubleClickEnabled="true" itemDoubleClick="refererRowDoubleClicked(event)">
      <mx:columns>
        <mx:DataGridColumn width="75" dataField="qty" headerText="Qty" />
        <mx:DataGridColumn dataField="referer" headerText="URL" />
      </mx:columns>
  </mx:DataGrid>  
</mx:HBox>

+1  A: 

I tested your code in Flex and it didn't make any difference which order they were in. The double click event fired either way. This was in a fresh project with no other code except the default stuff that a Flex application sets you up with.

Sometimes when a Flex project starts acting weird it helps to go to click Project -> Clean.

Do you get any errors or notices showing up in the Problems pane?

Greg W
+1 for "project > clean"
Robusto
I investigated the issue over the day and recognized this as an issue with Flash Player and Firefox under special circumstances. There was even a difference between a standalone swf and a version served by a Tomcat. I found an open issue in the adobe bugbase. The Flash Player Team works together with the Firefox team to find a solution for the problem.https://bugs.adobe.com/jira/browse/FP-3744The example (and also my project coding) works fine in Safari. Sorry for wasting your time. I'm new to Flex and never thought about testing with another browser.
MyMacAndMe