Author Topic: Parent-Child grid cannot save data changed in subgrid  (Read 618 times)

[email protected]

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 3
    • View Profile
Parent-Child grid cannot save data changed in subgrid
« on: March 17, 2022, 05:36:36 pm »
Hi,

I have used nested grid to show details on my page.

When I update data in parent row and nested grid, both - data for parent row and child grid -  is updated successfully.
But when only data in child grid (detail model) is updated, it is marking it dirty, still data is not saved - may be because there's no change in parent row.

How can I get this working in all scenarios?


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Parent-Child grid cannot save data changed in subgrid
« Reply #1 on: March 17, 2022, 06:02:39 pm »
How have you set up parent and child grids?

is the data of child grid coming from a different remote table than that of parent grid?

Is it local data or lazy loading for nested grid?

Could you share a jsfiddle so that I can look into it.
« Last Edit: March 17, 2022, 06:05:48 pm by paramvir »

[email protected]

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 3
    • View Profile

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Parent-Child grid cannot save data changed in subgrid
« Reply #3 on: March 21, 2022, 06:39:02 pm »
Please use later version which allows you to extract rowIndx from rowData ( rowData.pq_ri )

Steps:

Add a hidden boolean field e.g., "changed" in main grid.

Pass on reference to rowData to ProjectDataFT method.

Add a change event handler in detail grid to signal the main grid about the change.

Code: [Select]
change: function(evt, ui) {
        grid.updateRow({
          rowIndx: rowData.pq_ri,
          newRow: {
            'changed': true           
          }
        });
      },