collapse treegrid fully

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

collapse treegrid fully

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

Hi,

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?

thanks,
Steve.

jomitech
Site Admin
Posts: 1972
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) {
    return;
}
loaded = true;

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

dbrazoli
Posts: 69
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?
Thankful.

Daniel

Post Reply