collapse treegrid fully

PlatinumGrid - Full version
Post Reply
Posts: 3
Joined: Wed Dec 29, 2010 2:00 am

collapse treegrid fully

Post by sdelinkeroever » Tue Jan 18, 2011 1:06 am


The hierarchical data presentation or tree grid is by default fully expanded on loading the page. Is there way to make it fully collapse on loading?


Site Admin
Posts: 1995
Joined: Wed Oct 08, 2008 12:23 am

Re: collapse treegrid fully

Post by jomitech » Tue Jan 18, 2011 9:53 am

Not as part of the grid, no, but you can add some extra JavaScript that collapses the cells once the grid is loaded. Use the grid's JavaScript OnDataLoad event, and put the following JS into that event:

Code: Select all

if (typeof(loaded) != "undefined" && loaded) {
loaded = true;

jQuery("#JTPlatinumGrid1 .row .cellwithchildren").each(function() {
    var div = jQuery(".cellexpand", this)[0];
    var num ='_')[2];
    sender._cellExpand(null, div,, num);

Posts: 73
Joined: Thu Dec 19, 2013 6:33 pm

Re: collapse treegrid fully

Post by dbrazoli » Thu Oct 10, 2019 2:16 pm

Hello Jon.
About this answer, what would it be like for nodes in a treeview to be expanded or collapsed only when clicked on the node?
And how do I capture the value of the selected item?


Post Reply