ParamQuery grid support forum

General Category => Help for ParamQuery Grid (free version) => Topic started by: Bernd on November 06, 2018, 06:27:57 pm

Title: treeGrid collapse levels that are > 1
Post by: Bernd 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
Title: Re: treeGrid collapse levels that are > 1
Post by: paramvir 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.
Title: Re: treeGrid collapse levels that are > 1
Post by: Rasith on October 01, 2021, 12:25:37 am
Similarly can you please tell how to un collapses it .
Thank you.