4 Replies Latest reply on Aug 3, 2011 9:49 PM by Venkatesan Balasubramanian

    How to delete a Selected row from datagrid and how to create a datagrid popup with saved values

    Venkatesan Balasubramanian Level 1

      hi friends,

       

       

                    I am new to flex.i am doing a flex4 application,i need help for this.

       


                  i am having a data grid with columns.i have two questions.

       

                 Ques 1: when i selected a partiuclar row from a datagrid and click delete button means that record will delete from the datagrid and DTO from the cloud tables also.

       

                  Ques 2: when i save the data grid values using save button means that data will store in respective cloud DTO which is related to the datagrid,

       

                      My requirement is i am using a search button when i click the search button it will show a datagrid that datagrid will contain the previous datagrid datas which is saved in the cloud.

       

       

      REQUIREMENT example: first screen: i am using with data grid 3 columns (Student Roll number ,Student Name,Student pecentage)---->save--->data will store in cloud DTO.

       

       

      Second screen: search button ----> it need show  datagrid popup.it will have data which we saved in the first screen with same columns(Student Roll number ,Student Name,Student pecentage).

       

       

      This is my requirement.

       

      Any suggession welcome.

       

       

      Thanks in advance.

       

       

      B.Venkatesan

        • 1. Re: How to delete a Selected row from datagrid and how to create a datagrid popup with saved values
          FahaAK

          hi...


          primarily apologize as im not posting the answer for you're question rather im having my own question...im asking you this coz  believe u have achieved what im stuck up with...

           

          could you tell me how are you doing the insertion,deletion operations on a datagrid....i mean i know how java sends objects to flex but im afraid i have no idea about flex sending objects to java for updating the databases...please let me know or just share a code snippet...thanks and appreciate if you could reply..

          • 2. Re: How to delete a Selected row from datagrid and how to create a datagrid popup with saved values
            Nishant Jha28 Level 2

            Lets break the problem statement in multiple steps

             

            1. We need a way to know the selection on all rows.

            2. We need the association of the checkBox with the data

             

            The  solution is to use a arrayCollection/array that holds all the instances  created for checkbox.This collection should be a property of component  containing the datagrid. We need to use a custom component  implementation or inline ItemRenderer. The way you have used is called  dropinItemRenderer. Preferaly use custom component implementation and  add the instance to the arrayCollection at CreationComplete. Make sure  you use addItemAt so that you add the instance in the same row as the  data. To get rowIndex the custom Checkbox should implement  IDropInListItemRenderer. You could iterate this collection to check all  the instances that are checked.

             

            Note: This is the approach considering your dataprovider doesnt have a selection field.

             

            Nishant

            • 3. Re: How to delete a Selected row from datagrid and how to create a datagrid popup with saved values
              Nishant Jha28 Level 2

              For sending objects to java side you need a DataService like BlazeDS/GraniteDS/LCDS. I suppose you already know this part... You can interact using Value Objects. Check on the web for the exact syntax. Sending request with parameter works exactly the same way as a method that doesnt have one. Only thing you should take care is that you send and read same properties and in same order. Though it is already done in this way but can be causing problems sometimes. In case of nested objects, make sure both the parent and child are serializable. Use interfaces, IExternizable in Flex and Externizable in java side.

               

              Nishant

              1 person found this helpful
              • 4. Re: How to delete a Selected row from datagrid and how to create a datagrid popup with saved values
                Venkatesan Balasubramanian Level 1

                hi nishan,

                 

                 

                first off all thanks for the quick reply.

                 

                 

                I am doing in flex4 with AS3 with normal oops concepts.regarding this way of approch how creat a popup,that popup in the view of datagrid that data grid should contain the preivously stored value. That values should read from IPP DTO(Data Transfrer Object)table.

                 

                 

                Can u help;

                 

                If  possible send  a snippet of code for my clear understanding.

                 

                 

                Thanks in Advance;


                B.Venkatesan