Author Topic: treeGrid collapse levels that are > 1  (Read 2872 times)

Bernd

  • Newbie
  • *
  • Posts: 3
    • View Profile
treeGrid collapse levels that are > 1
« on: November 06, 2018, 06:27:57 pm »
Hello,

I'm using pqGrid with tree. When it initially loads i want to have levels > 1 collapsed and the others opened. For this I want to set the pq_close parameter to 1 when pq_level > 1.

I'm trying to find the right event but the complete event is already too late since it already displays data and the load event is too early because it doesn't have the pq_level parameter yet. Other events that i tried like for example beforeTableView fire too often. I would like the event to fire only at initial load of the grid

Hope this was understandable and would appreciate your help.

Kind regards,
Bernd
« Last Edit: November 06, 2018, 06:32:59 pm by Bernd »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: treeGrid collapse levels that are > 1
« Reply #1 on: November 06, 2018, 07:49:10 pm »
Please use treegrid collapseNodes() API like this:

Code: [Select]
complete: function(){     
      var arr = this.pageData().filter(function(rd){
          return (rd.pq_level>1);
      })
      this.Tree().collapseNodes(arr);
},

https://next.plnkr.co/edit/sBYI3zTornDUg4oT?preview


PS: treegrid is a Pro feature, please share your Pro credentials so that your account can be upgraded to Pro.
« Last Edit: November 07, 2018, 10:02:56 am by paramquery »

Rasith

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: treeGrid collapse levels that are > 1
« Reply #2 on: October 01, 2021, 12:25:37 am »
Similarly can you please tell how to un collapses it .
Thank you.