Author Topic: Update the value of parent grid rows based upon nested records  (Read 3155 times)

tarunsharma

  • Newbie
  • *
  • Posts: 20
    • View Profile
Update the value of parent grid rows based upon nested records
« on: January 09, 2021, 03:03:20 am »
I have parent grid rows are showing sum of their nested records. Nested grid has filter option. I want to ask If I filter nested grid records, is it possible to update parent grids rows accordingly. Can you suggest something?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Update the value of parent grid rows based upon nested records
« Reply #1 on: January 10, 2021, 10:20:21 pm »
filter event is fired when records are filtered.

So you can listen to filter event of nested grids and call updateRow on the corresponding parent row.

tarunsharma

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Update the value of parent grid rows based upon nested records
« Reply #2 on: January 12, 2021, 12:50:32 am »
I tried to update parent row within nested grid filter option but didn't work. For your reference I am share the code.

filter: function (event, ui) {
       var grid = $(".vc-facility-detail").pqGrid('getInstance').grid; //instance of master grid
       grid.updateRow({ rowIndx: 0 });
}

Can you suggest something.
« Last Edit: January 12, 2021, 12:52:41 am by tarunsharma »

tarunsharma

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Update the value of parent grid rows based upon nested records
« Reply #3 on: January 12, 2021, 11:14:00 am »
I tried to update parent row using nested grid filter option but didn't work. I want to change the value of main grid row based upon filtered nested rows. For your reference I am sharing my code.

filter: function (event, ui) {
       var grid = $(".vc-facility-detail").pqGrid('getInstance').grid; //instance of master grid
       grid.updateRow({ rowIndx: 0 });
}

Can you suggest something.

tarunsharma

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Update the value of parent grid rows based upon nested records
« Reply #4 on: January 14, 2021, 12:28:47 am »
I am able to update parent row based upon filtered nested grid using updateRow() method. Now I am facing the problem to update grand summary as par the updated rows of main grid. UpdateRow() method is not working to update summary row. can you suggest something?

tarunsharma

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Update the value of parent grid rows based upon nested records
« Reply #5 on: January 14, 2021, 11:45:47 am »
I am trying to update summary values using "summaryData". But that is not working. Find an example shown below and let me know if I am doing something wrong. Thanks

var jsonFormat= JSON.stringify(summaryColumnList);
$grid.option("summaryData", [ jsonFormat ]);
$.grid.refresh();

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Update the value of parent grid rows based upon nested records
« Reply #6 on: January 14, 2021, 10:40:46 pm »
Excel formulas can be used in grand summary row which auto updates itself.

https://paramquery.com/pro/demos/summary_json