3 Replies Latest reply on Jul 20, 2009 3:43 AM by Madhav Subedi

    Regarding - How to access the component id in item renderer from the action script

    GG_81

      Hi,

           I'm attaching screen shot and snippet of code, following the screen shot i'll discuss my problem.

       

      input_image.JPG

       

      Here you can see two panels having same data but each panel is having its own dataprovider. I have used itemRenderer for the combobox. When parameter type "Date" is selected in either of the row of each panel then at that time date combobox has to become visible as i'm having different date formats in the comboxbox. I have used out outerDocument to call the method in the actionscript but i'm unable to access the id of date format combobox. As i have putted alert to check is i'm able to call the method, tht's working fine. Please help me how control the visibility(visible=true/visible=false) of the date format combo box on the selection of date in the parameter type combo box. I'm also pasting snippet of code here...

       

       

      <mx:Script>
          <![CDATA[
              import mx.controls.Alert;
              import mx.controls.ComboBox;
              import mx.events.CloseEvent;
                //TO Check the condition on ComboBox
              public function closeHandler(event:Event):void{
                  //Alert.show('Hello');
                  if(ComboBox(event.target).selectedIndex == 1)
                      Alert.show('parentApplication.paramType')
                       
                        //inputGrid.paramType.visible=true;
                        //parentApplication.comboD.visible=true;
                  //else
                      //parentApplication.comboD.visible=false;
              }
          ]]>
      </mx:Script>
      <mx:XMLList id="service" xmlns="">
            <parameter>
                <parameterName>Param - 1</parameterName>
                <comboSlctIdx>0</comboSlctIdx>
                <validSlctIdx>0</validSlctIdx>   
               
               
            </parameter>
           
            <parameter>
                <parameterName>Param - 2</parameterName>
                <comboSlctIdx>0</comboSlctIdx>
                <validSlctIdx>0</validSlctIdx>   
                <dtSlctIdx>0</dtSlctIdx>
               
            </parameter>
      </mx:XMLList>
      <mx:XMLList id="comboDS" xmlns="">
          <parameter>
                <label>String</label>
                <data>true</data>         
            </parameter>
            <parameter>
                <label>Date</label>
                <data>true</data>         
            </parameter>
            <parameter>
                <label>Integer</label>
                <data>true</data>         
            </parameter>   
      </mx:XMLList>

       

      <mx:XMLList id="comboV" xmlns="">
          <parameter>
              <label>Required</label>
              <data>true</data>
          </parameter>
          <parameter>
              <label>Not Required</label>
              <data>true</data>
          </parameter>
         
      </mx:XMLList>

       

      <mx:XMLList id="comboD" xmlns="">
          <parameter>
              <label>DD/MM/YYYY</label>
              <data>true</data>
          </parameter>
          <parameter>
              <label>MM/DD/YYYY</label>
              <data>true</data>
          </parameter>
          <parameter>
              <label>YYYY/MM/DD</label>
              <data>true</data>
          </parameter>
      </mx:XMLList>

       

       

       

          <mx:XMLList id="service1" xmlns="">
            <parameter>
                <parameterName>Param - 1</parameterName>
                <comboSlctIdx>0</comboSlctIdx>
                <validSlctIdx>0</validSlctIdx>   
            </parameter>
           
            <parameter>
                <parameterName>Param - 2</parameterName>
                <comboSlctIdx>0</comboSlctIdx>
                <validSlctIdx>0</validSlctIdx>   
                <dtSlctIdx>0</dtSlctIdx>
            </parameter>
      </mx:XMLList>

       

      <mx:XMLList id="comboDS1" xmlns="">
          <parameter>
                <label>String</label>
                <data>true</data>         
            </parameter>
            <parameter>
                <label>Date</label>
                <data>true</data>         
            </parameter>
            <parameter>
                <label>Integer</label>
                <data>true</data>         
            </parameter>   
      </mx:XMLList>

       

      <mx:XMLList id="comboV1" xmlns="">
          <parameter>
              <label>Required</label>
              <data>true</data>
          </parameter>
          <parameter>
              <label>Not Required</label>
              <data>true</data>
          </parameter>
         
      </mx:XMLList>

       

      <mx:XMLList id="comboD1" xmlns="">
          <parameter>
              <label>DD/MM/YYYY</label>
              <data>true</data>
          </parameter>
          <parameter>
              <label>MM/DD/YYYY</label>
              <data>true</data>
          </parameter>
          <parameter>
              <label>YYYY/MM/DD</label>
              <data>true</data>
          </parameter>
      </mx:XMLList>

       

       

      <mx:DataGrid id="inputGrid" width="100%" dataProvider="{service}">
                <mx:columns>
                    <mx:DataGridColumn headerText="Parameter Name" dataField="parameterName" fontFamily="Arial" letterSpacing="1" textAlign="center" />
                    <mx:DataGridColumn headerText="Parameter Type" fontFamily="Arial" letterSpacing="1" textAlign="center">
                        <mx:itemRenderer>
                            <mx:Component>
                                <mx:HBox horizontalAlign="center">
                                   
                                    <mx:ComboBox id="paramType" dataProvider="{parentApplication.comboDS}" selectedIndex="{data.comboSlctIdx}" close="outerDocument.closeHandler(event);"/>                             
                                               
                                </mx:HBox>
                            </mx:Component>
                        </mx:itemRenderer>
                        </mx:DataGridColumn>   
                       
                    <mx:DataGridColumn headerText="Validation" fontFamily="Arial" letterSpacing="1" textAlign="center">
                        <mx:itemRenderer>
                            <mx:Component>
                                <mx:HBox horizontalAlign="center">
                                    <mx:ComboBox dataProvider="{parentApplication.comboV}" selectedIndex="{data.validSlctIdx}"/>   
                                </mx:HBox>
                               
                         
                 
                            </mx:Component>
                        </mx:itemRenderer>
                        </mx:DataGridColumn>   
                    <mx:DataGridColumn headerText="">
                        <mx:itemRenderer>
                            <mx:Component>
                                <mx:HBox horizontalAlign="center">
                                    <mx:ComboBox id="dtType" dataProvider="{parentApplication.comboD}" selectedIndex="{data.dtSlctIdx}" visible="false"/>   
                            </mx:HBox> 
                               
                           
                            </mx:Component>
                        </mx:itemRenderer>
                    </mx:DataGridColumn>                
                   
                </mx:columns>
            </mx:DataGrid>

       

       

      Thanxs

       

      Gaurav