Author Topic: Expand or Collapse Grid rows on button click  (Read 2669 times)

tarunsharma

  • Newbie
  • *
  • Posts: 20
    • View Profile
Expand or Collapse Grid rows on button click
« on: December 12, 2020, 04:16:27 am »
I need to add Expand And Collapse button on the header of the pqgrid

For Example - Expand All :- That is expand all the rows of the grid all together.
Collapse All :- To collapse all the rows.

Can you suggest the best possible way to implement this functionality.

Thanks




« Last Edit: December 12, 2020, 04:54:50 am by tarunsharma »

tarunsharma

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Expand or Collapse Grid rows on button click
« Reply #1 on: December 15, 2020, 01:53:18 am »
Can anyone from the support team help me to expand all the rows on button click?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6113
    • View Profile
Re: Expand or Collapse Grid rows on button click
« Reply #2 on: December 15, 2020, 09:59:55 pm »
To exapand / collapse all row details, iterate through all rows and apply show: true /false to pq_detail property of rowData

Code: [Select]
grid.pageData().forEach(function(rd){
rd.pq_detail = {show: true/false};
})
grid.refresh()

tarunsharma

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Expand or Collapse Grid rows on button click
« Reply #3 on: December 16, 2020, 01:14:25 am »
It is working on the very first click. If I collapse few rows and click expand button again it will not work.
« Last Edit: December 16, 2020, 02:24:25 am by tarunsharma »

tarunsharma

  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Expand or Collapse Grid rows on button click
« Reply #4 on: December 16, 2020, 09:38:00 pm »
not able to click Expand All button second time. Can anyone help?