1 Reply Latest reply on Jan 20, 2011 5:55 AM by RUSH-ME

    Editable Data grid column

    satyasuppu Level 1

      Hi,,

       

       

        I have a datagrid ..In that one column is editable and user is able to enter the data and it should not be visible (like password filed.)So..ii am showing the data which user entered in editable datagrid column in (Astrick *.)

       

      Below is the code..

       

       

      In my aplication..i have many Jobs .which i am showing in datagrid..User select one Jobfrom the DG and click on "load" button it goes to next screen..

       

      In next scrren i am again showiing  (multiple)scripts details for that perticular job in datagrid..In that datagrid i have given button for every column..

       

      If user click on that one script one popup window(TitleWindow) will come(below is the code....)..

       

      if .encryptData="Y" i have to show data in *..Other wise data will be readable by user..

       

      Here i am facing problem...

       

      in that popupwindow..for that answer column..if any data is there already and i want to edit that data(means enter new data after the existing one)

      EX::In answer column

       

          already has some data:::simple(which shown in * )

          I want to edit the data means..want to enter some data after the exising one)

       

         ex:simple123 (*********)

                              (simple123)

       

      but when i am trying to acess the value i am getting ******123..

      I want to get simple123..Because it is taking already existing data in * not as cleartext..

       

      Please help me how to get the data correctly if i edit the value...Please...

       

       

      <mx:DataGrid width="549" height="335" id="QuesAnsDG1" editable="true">
                  <mx:columns>
                      <mx:DataGridColumn headerText="Question" dataField="question" wordWrap="true" editable="false"/>
                      <mx:DataGridColumn  visible="false" dataField="encryptData" />
                      <mx:DataGridColumn headerText="Answer" dataField="answer" labelFunction="getEncData" wordWrap="true" editable="true"/>
                      <mx:DataGridColumn headerText="NeedAnswer" dataField="neededAnswer" wordWrap="true" width="80" editable="false"/>
                  </mx:columns>
              </mx:DataGrid>
              <mx:Button x="481" y="338" label="OK" width="59" id="OKBttn" click="okButtonClicked()"/>

       

       

       

      public function getEncData(item:Object,column:DataGridColumn):String
                  {
                       //Alert.show(item.answer+"encrypt::"+item.encryptData);
                       //var anslength:String=item.answer;
                       var pwd :String= item.answer;
                       if(item.encryptData=='Y')
                       {
                           if(null!=pwd)
                           {
                              
                               var pwdrnd:String="";
                                for(var i:int=0;i<pwd.length;i++)
                              {
                                  pwdrnd+="*";
                              }
                                 pwd=pwdrnd;
                          }
                      }
                      return pwd;
                 
                   }

       

       

       

      Thanks & regards,

      satya