Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Get edited child record from Embedded Grid

    We have a List grid which implements expanding rows feature with related records. The embedded gird which appears on expansion is editable.

    While saving the grid with edited values using - saveAllEdits, we find only the parent row edited values being send to the server and not the child grid edited values.

    Is there another method [could not find in the documentation though] for saving *expanded rows* ?

    #2
    Updating title

    Comment


      #3
      If you made the nested grid editable by just changing expansionRelatedProperties, the parent grid is not aware you've made it editable so will not manage the nested data. You could add an override to collapseRecord() to cause saving to occur.

      Comment


        #4
        Thank you. The grid is made editable by setting the property - expansionCanEdit:true on the parent grid. The user may have multiple rows expanded and values edited.

        On click of - Save button, the requirement is to submit all edited records including parent and child to the server.

        Will collapseRecord() overriding send edited info for the entire grid to the server ?

        Note : I understand collapseRecord() method to be specific to a single record and not multiple records.

        Comment


          #5
          To be more specific, the user may expand multiple rows, edit them and may not choose to collapse.

          Saving of the entire grid including parent and detail records are on an external button click.

          Comment


            #6
            The default behavior on collapse is to destroy the grid in question. So you probably want to override getExpansionComponent() and set destroyOnUnEmbed:false to prevent automatic destruction on collapse. Then cache the created grid as a property on the record so you can return it next time getExpansionComponent() is called.

            Finally, when you are about to call saveAllEdits() for the parent grid, call it on all child grids as well (in a queue via isc.RPCManager.startQueue()).

            Comment


              #7
              Thanks Isomorphic. We've started implementing this.

              One query though. When you say - *cache the grid as a property on the record*, do you mean creating a ResultSet object and adding the object as a parameter to the row ?

              Comment


                #8
                No, store the actual ListGrid instance on the Record via setAttribute, or better yet, store it in a related Map keyed by the primary key of the Record.

                Comment


                  #9
                  Ok, we are now done with the following :

                  - set destroyOnUnEmbed:false to prevent automatic destruction on collapse
                  - cache the created grid as a property on the record

                  What we are missing is a handle to the embedded grid, which can be called on click of *Save* button.

                  For instance, on click of *Save*, current implementation is to call saveAllEdits() on the parent grid alone. Now to make the saveAllEdits on the embedded grid, the handle to this grid is required.

                  There is no api method like - getEmbeddedGrid(Record r).

                  Tried using - getExpansionComponent (record), but it does not return a grid instance.

                  Please suggest.

                  Comment


                    #10
                    Again, override getExpansionComponent. By calling Super(), you can get a handle to the nested grid instance that the ListGrid creates automatically.

                    Comment


                      #11
                      Hello,

                      How do we get the control for the parent record under which the child grid expands?
                      I have some edits in the child grid and those changes should get reflected in the parent record of the main grid.
                      I saw the documentation but i could not find any pointers to parent record.
                      This is like I need to change the value in parent record if something changes in child grid for eg: I can sum up the values in all the rows of child grid and show the sum in parent record of main grid.
                      Last edited by ypoovil; 19 Jul 2010, 18:56.

                      Comment


                        #12
                        The answer to every question in this thread has been to look at the docs for getExpansionComponent(), and that's the answer again - the record is passed to this API, so you can store a reference to it on the grid if you need it later.

                        Comment

                        Working...
                        X