Author Topic: How to not close nested child grid when refreshing parent grid.  (Read 1120 times)

joelclark

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 10
    • View Profile
How to not close nested child grid when refreshing parent grid.
« on: December 10, 2020, 02:58:09 am »
Hi There,

If I save a record in the child grid then it collapses it and you have to reopen it. Is there a way to stop this? After save we are calling "$(".vc-facility-detail").pqGrid("refreshDataAndView");"

Before save image is before save.jpg. Also I don't get how to attach pictures to the post with the whole "" thing.



 If we change the highlighted yellow column and save it then it looks like the aftersave.jpg image.


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 5182
    • View Profile
Re: How to not close nested child grid when refreshing parent grid.
« Reply #1 on: December 10, 2020, 05:57:41 pm »
There is no need to call refreshDataAndView to save data in grid. Even if you need it for some other purpose, you can call refreshDataAndView on the child grid, why call it on the parent grid?

joelclark

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: How to not close nested child grid when refreshing parent grid.
« Reply #2 on: December 10, 2020, 08:08:19 pm »
So we are calling refreshDataAndView on the parent because if you look at the column "Sust Pac" The parent row has the total of "3,000.090" and then the two detail grid records are "1.000" and "2,999.090". If I update the detail grid record to be "2.000" instead of "1.000" I want the parent grid column of "3,000.090" to update to "3001.090" if that makes sense? Basically after the save we want to update the value of both grids and if we call the refresh just on the child then it doesn't update the parent records amount.

Thanks,
Joel

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 5182
    • View Profile
Re: How to not close nested child grid when refreshing parent grid.
« Reply #3 on: December 10, 2020, 10:16:17 pm »
No need to use refreshDataAndView, updateRow method can be called on parent grid from child grid to update values in the parent grid.

Another easy solution: since you have same columns in parent and child, treegrid could be used and Excel formulas could be used in parent rows to auto update the values when values in child rows change.

tarunsharma

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: How to not close nested child grid when refreshing parent grid.
« Reply #4 on: December 19, 2020, 01:01:04 am »
I am calling refreshDataAndView() on nested grid inorder to show updated value, but still struggling to show updated value on parent grid. I tried updateRow() but didn't work can you suggest something?
« Last Edit: December 19, 2020, 01:05:23 am by tarunsharma »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 5182
    • View Profile
Re: How to not close nested child grid when refreshing parent grid.
« Reply #5 on: December 22, 2020, 09:42:54 am »
What difficulty are you facing with updateRow? It's supposed to work.

As mentioned earlier, treegrid is an alternative solution and is better fit for your use case.