2 Replies Latest reply on Nov 19, 2009 8:00 AM by Bhulka

    Link button in Datagrid

    Bhulka

      Hello everyone,

       

      I am new to Flex, I have some trouble when using link button with datagrid column. What I want to do is when I click on link button in datagrid, it should take me to another state but unfortunately it is not happening for me. This datagrid is in customised component, not in main application MXML. I tried using various options but not able to figure it out. one thing that I doubt is since link button is inside loop as shown below it is not able to recognize the command: currentState = ''; My code looks like:

       

      (Any help would be really appreciated!!)

       

      <mx:DataGrid

       

      x="0" y="0" id="ScacTable" textAlign="center" width="788" height="249" borderColor="#111415" color="#000102" fontSize="10" verticalAlign="middle" fontWeight="normal" dataProvider="{datap}">

       

       

      <mx:columns>

       

       

      <mx:DataGridColumn width="60" editable="false" headerText="SHIP ID" dataField="SHIP_ID">

       

       

       

                <mx:itemRenderer>

       

       

                             <mx:Component>

       

       

                                              <mx:LinkButton click="LinktoShipId()" label="{data.SHIP_ID}" textDecoration="underline">

       

       

                                                        <mx:Script>

                                                             

                                                             <![CDATA[

       

                                                                         import mx.controls.Alert;

       

       

       

                                                                                   public function LinktoShipId():void

                                                                                                {

                                                                                                          currentState='';

       

       

                                                                                                }

                                                                                ]]>

       

                                                           </mx:Script>

          

       

       

       

           </mx:LinkButton>

       

       

       

      </mx:Component>

       

       

      </mx:itemRenderer>

       

       

       

      </mx:DataGridColumn>