0 Replies Latest reply on Oct 17, 2010 11:46 PM by Sonunew2flex

    how to give focus to the dynamically generated textinput inside datagrid

    Sonunew2flex Level 1

      Dear Friends,

       

      this is my datagrid column

       

         <mx:DataGridColumn headerText=" " dataField="SEL" width="40" textAlign="center" editable="false">
                      <mx:itemRenderer>
                          <mx:Component>
                              <mx:VBox clipContent="false" verticalAlign="middle" horizontalAlign="center">
                                  <mx:CheckBox selected="{data.SEL}" click="parentDocument.fnUpdateXml(data.SEL)"/>
                              </mx:VBox>
                          </mx:Component>
                      </mx:itemRenderer>
                  </mx:DataGridColumn>

        <mx:DataGridColumn headerText="Password" editable="false">
                      <mx:itemRenderer>
                          <mx:Component>
                              <mx:Canvas>
                                  <mx:TextInput id="pwd" editable="true" text="{data.PWD}" displayAsPassword="true" width="100%"
                                      height="19" change="parentDocument.fnTextToGrid(event)" maxChars="18" />
                              </mx:Canvas>
                          </mx:Component>
                      </mx:itemRenderer>
                  </mx:DataGridColumn>

       

      Using the selected column i have to validate the text entered in texinput and i have to give focus to TextInputinside itemRenderer.

       

      How can i do this? any idea

       

       

      this is how i am trying to do

       

                           for(iElement=0; iElement<EmpPwdArray.length;iElement++)
                           {
                               if(EmpPwdArray[iElement].SEL == true)
                               {
                                   var bolval:Boolean;
                                   intChk=1;   
                                  bolval=mx.core.Application.application.objpass.validatePassword(EmpPwdArray[iElement].PWD );
                                  if(bolval == false)
                                  {
                                       EmpPwdArray[iElement].pwd.setFocus();   // this is wrong format. so i have to focus to particular textinput section                              
                                  }
                                  else
                                  {
                                       EmpPwdXML.EMPPWD[iElement].PWD=EmpPwdArray[iElement].PWD;                           
                                  }
                     
                               }

       

                           }

       

      this is not indentifying pwd id for textinput, i guess some other procedure to access that textinput.