Collapsing all Slickgrid trees on page load
How to have Slickgrid's collapsible trees start开发者_Python百科 out collapsed on page load, rather than expanded?
You can set the _collapsed property to true for the nodes with childs:
d["_collapsed"] = true
For me calling dataView.collapseAllGroups()
prior to rendering the table was sufficient to start up with collapsed groups.
Note that slickgrid currently has a bug concerning groups: Slickgrid grouping expand/collapse strange behaviour which can be fixed using this commit
Here's how I did it in a demo (no DB). You'll have to get the actual number of groups from your DB, then just loop through the grid and close 'em all:
for(var i=0; i<7; i++) {
dataView.collapseGroup(i);
}
精彩评论