Author Topic: Collapse/Expand row in Grid based on hide/show rows  (Read 2542 times)

Jignesh

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 46
    • View Profile
Collapse/Expand row in Grid based on hide/show rows
« on: May 12, 2020, 09:15:30 am »
Hi Paramvir,

I have created fiddle demo for Collapse/Expand row in Grid.

https://jsfiddle.net/cherishPatel/8jqys3e5/18/

If user click on Id 17 row's "Collapse" button then 18 and 19 Ids should be hide and button name changed "Expand'.
And click on Id 17 row's "Expand" button then 18,19 Ids should be show and button name changed to "Collapse".


Thank you,
Jignesh

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Collapse/Expand row in Grid based on hide/show rows
« Reply #1 on: May 12, 2020, 10:57:55 am »
Your use case closely resembles that of treegrid.

Please follow it rather than trying to reinvent the wheel.

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

And call the Tree() API methods collapseNodes, expandNodes from click of buttons.

https://paramquery.com/pro/api#method-Tree
« Last Edit: May 12, 2020, 11:00:53 am by paramvir »

Jignesh

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 46
    • View Profile
Re: Collapse/Expand row in Grid based on hide/show rows
« Reply #2 on: May 12, 2020, 01:20:18 pm »
Hi Paramvir,

We have required functionality base on collapse and Expand button on row level so tree functionality does not work for our case.

I have also added code on Prerender method, below URL for that https://jsfiddle.net/cherishPatel/8jqys3e5/28/

I have able to collapse and expand rows base on the row button. The only issue we have not able to change the button name or +/- sign.

Thank you,
Jignesh

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Collapse/Expand row in Grid based on hide/show rows
« Reply #3 on: May 12, 2020, 07:07:00 pm »
Quote
We have required functionality base on collapse and Expand button on row level so tree functionality does not work for our case.

Collapse and Expand buttons can be used instead of default node renderers in treegrid with help of column.render

Quote
I have able to collapse and expand rows base on the row button.

I don't see it working in your jsfiddle. Please use inbuilt Tree() API to expand / collapse rows instead of writing the logic from scratch.