2 Replies Latest reply on Oct 2, 2007 11:37 PM by chris.huston.t10

    Help Regarding DataGrids SelectedIndex

    mnarra Level 1
      Hi All,

      Let me explain my scenerio..

      I have a DataGrid populated with few records.

      Placed a linkbutton in one of the column's in each row, so that when its clicked a popup window opens.

      Clicked the linkbutton --> popup appeared --> Closed the Popup.

      Again clicking on the same linkbutton no event is fired and popup is not shown up .

      But when clicking on other rows linkbutton event is fired and popup is shown

      My Question is why does the event not fired on the same row linkbutton when its called the second time ?

      Thought that it would be due to selecetedIndex and made that to -1 immediatly after the popup is closed.

      But its not resolved..

      Please help me out with this !!!

      Regards,
      Madan N

        • 1. Re: Help Regarding DataGrids SelectedIndex
          mnarra Level 1
          Hi All,

          Any Idea how to resolve this ?

          Madan N
          • 2. Re: Help Regarding DataGrids SelectedIndex
            chris.huston.t10 Level 3
            Try this:

            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">

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

            [Bindable]
            private var ac:ArrayCollection = new ArrayCollection([{col1:10,col2:20,col3:30}, {col1:15,col2:25,col3:35}]);

            public function clickLB(col:Object):void {
            Alert.show(col.col3);
            }
            ]]>
            </mx:Script>
            <mx:DataGrid x="10" y="10" dataProvider="{ac}">
            <mx:columns>
            <mx:DataGridColumn headerText="Column 1" dataField="col1"/>
            <mx:DataGridColumn headerText="Column 2" dataField="col2"/>
            <mx:DataGridColumn headerText="Column 3" dataField="col3">
            <mx:itemRenderer>
            <mx:Component>
            <mx:HBox horizontalAlign="center" paddingLeft="10">
            <mx:LinkButton label="{data.col3}" click="outerDocument.clickLB(data)"/>
            </mx:HBox>
            </mx:Component>
            </mx:itemRenderer>
            </mx:DataGridColumn>
            </mx:columns>
            </mx:DataGrid>

            </mx:Application>

            Vygo