Author Topic: Add rows while grouping  (Read 2022 times)

luckduck

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 46
    • View Profile
Add rows while grouping
« on: May 11, 2020, 01:42:17 pm »
Hi Paramvir,


In the example below, if you select the 4th row and add a row, it is added to the 8th row.

How to add new row after selected cell/row in group

https://jsfiddle.net/uzqj1mwv/

Thank you

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6283
    • View Profile
Re: Add rows while grouping
« Reply #1 on: May 11, 2020, 03:08:24 pm »
Thanks for your question.

Rows are not to be added in row grouping view with addRow method.

Please use Group() API ( addNodes, deleteNodes, moveNodes methods ) to add, remove or move rows while grouping.

https://paramquery.com/pro/api#method-Group
« Last Edit: May 11, 2020, 03:10:45 pm by paramvir »

luckduck

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: Add rows while grouping
« Reply #2 on: May 14, 2020, 11:56:58 am »
I am trying to add rows using addNodes, but I can't find a solution. thank you for your help

https://jsfiddle.net/xr5pLen9/

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6283
    • View Profile
Re: Add rows while grouping
« Reply #3 on: May 14, 2020, 03:58:05 pm »
Hope this helps:

Code: [Select]
       var Group = this.Group(),
             parent = Group.getParent(selRow),
             indx = Group.getChildren(parent).indexOf(selRow);
 
       Group.addNodes([newData], parent, (indx + 1));

https://jsfiddle.net/1sq9Lckm/