0 Replies Latest reply on May 5, 2010 2:28 AM by manpakhong

    How to Get DataGrid ItemRenderer Controls?

    manpakhong

      Dear, I want to get Controls (Radio Buttons) from DataGrid within itemRenderer on Item Click event.

      Can you give me a sample code?

       

       

      =====================================================

      <?xml version="1.0" encoding="utf-8"?>
      <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%">
          <mx:Script>
              <![CDATA[
                  import mx.events.*;
                  import mx.controls.Alert;
                  private function P4R_Y_change(e:Event):void
                  {
                      Alert.show(e.toString());
                     
                  }
                  private function P4R_N_change(e:Event):void
                  {
                      Alert.show(e.toString());
                  }
                 
                  private function onItemClick_gvPendingForReceipt(e:ListEvent):void
                  {
                      // want to get radio buttons here

                     Alert.show((e.target as DataGrid).columns[e.columnIndex].toString());
                  }

                 
              ]]>
          </mx:Script>

       

         
          <mx:Panel title="Pending for Receipt (NGO only)">
              <mx:DataGrid id="gvPendingForReceipt" itemClick="onItemClick_gvPendingForReceipt(event)">
                  <mx:dataProvider>
                      <mx:Object Case_No="cn8385738" JS_Name="Peter Wong" Remarks="" >
                      </mx:Object>
                      <mx:Object Case_No="cn4428255" JS_Name="Mary Queen" Remarks="Referal from SWD Special team!!">
                      </mx:Object>       
                  </mx:dataProvider>   
                  <mx:columns>
                      <mx:DataGridColumn headerText="Case #" width="150" dataField="Case_No" >
                      </mx:DataGridColumn>
                      <mx:DataGridColumn headerText="Job Seeker Name" width="150" dataField="JS_Name" >
                      </mx:DataGridColumn>       
                      <mx:DataGridColumn headerText="Accept Case?" width="200" >
                          <mx:itemRenderer>
                              <mx:Component>
                                  <mx:VBox>
                                      <mx:RadioButton id="rdoP4R_Y" label="Yes" group="{IsAccepted}" >
                                      </mx:RadioButton>
                                      <mx:RadioButton id="rdoP4R_N" label="No" group="{IsAccepted}" >
                                      </mx:RadioButton>       
                                      <mx:RadioButtonGroup id="IsAccepted">
                                      </mx:RadioButtonGroup>           
                                  </mx:VBox>   
                              </mx:Component>
                          </mx:itemRenderer>

                      </mx:DataGridColumn>
                      <mx:DataGridColumn headerText="Remarks">
                          <mx:itemRenderer>
                              <mx:Component>
                                  <mx:TextInput text="{data.Remarks}">
                                     
                                  </mx:TextInput>
                              </mx:Component>
                          </mx:itemRenderer>
                      </mx:DataGridColumn>                       
                  </mx:columns>   
                 
              </mx:DataGrid>
          </mx:Panel>
          <mx:Panel title="Pending for Intake (NGO only)">
          </mx:Panel>
          <mx:Panel title="Active Case List (NGO/ Case Management">
          </mx:Panel>
      </mx:VBox>

       

      Regards,

      Man Pak Hong, Dave

      manpakhong@hotmail.com

      Analyst Programmer.