2 Replies Latest reply on Oct 24, 2011 9:17 PM by xandout

    How to get Datagrid values into Textinput in flex4

    Venkatesan Balasubramanian Level 1

      hi friends.,

       

       

                 I am new to flex.i need help from u guys.i am using one datagrid with 3 columns named students name,student class,student percentage.after entering the details i am click the save button .the datas will store in Students DTO in cloud..

       

                 In next Screen i am using one search button and two text input(for students name and students percentage). while clicking the search button it will show the datagrid view it contains the students information which we given in the last screen and save.

       

               i am clicking a particular row from that datagrid. It should be  automatically display the student name in one textinput and show the student percentage in another text input.

       

      how i will get it.

       


      Any suggessions welcome.

       

      Thanks in advance,

       

      B.Venkatesan.

        • 1. Re: How to get Datagrid values into Textinput in flex4
          Kanchan Ladwani Level 2

          Hello B.Venkatesan,

           

            I am pasting code snippet below, u will get help from it.

          call this function in itemclik event of your datagrid.

           

          protected function dg_itemClickHandler(event:ListEvent):void
                      {
                          var txt1:TextInput = new TextInput();
                          var txt2:TextInput = new TextInput();
                          var newValue1:String = dg.selectedItem.name;     //dg is id of ur datagrid and name is the datafield of first column
                          txt1.text=newValue1;
                          txt1.x=350;
                          txt1.y=150;               
                          this.addElement(txt1);
                          var newValue2:String = dg.selectedItem.per;
                          txt2.text=newValue2;
                          txt2.x=350;
                          txt2.y=250;               
                          this.addElement(txt2);            
                      }

          Thanks and Regards,

          ---------------------------------------------------------------------- -----------------------------

          Kanchan Ladwani | kladwani@infocepts.com | www.infocepts.com

          ---------------------------------------------------------------------- -----------------------------

          1 person found this helpful
          • 2. Re: How to get Datagrid values into Textinput in flex4
            xandout

            right click the grid and select "selection change handler" then the code would be txtfield.text = datagrid.selectedite.{COLUM TITLE}