First of all, the collapse all method only collapse the first level.
How can I set my json data to trigger which groups should collapse?
My dataset has three tiers, Credit Card Group -> Credit Card Category -> Merchant.
First of all, the collapse all method only collapse the first level.
How can I set my json data to trigger which groups should collapse?
My dataset has three tiers, Credit Card Group -> Credit Card Category -> Merchant.
I wrote my own function to collapse a tree on all levels, it is a recursive function.
The issue with the collapseAll. Since it goes in order of the children, it will not collapse the sub node when the parent already is collapsed. (When you collapse in order, it skips the sub nodes of that child node)
So my function will go to the lowest tier and collapse upwards. Until it gets back to the root.
just call using
Code:
var treegrid = new dhx.TreeGrid("#treeGrid", {β¦});
collapseTree(treeGrid);
function collapseTree(treeGrid, parentId) {
if (parentId == undefined) {
parentId = treeGrid.data.getRoot();
}
treeGrid.data.eachChild(parentId, function (_a) {
if (_a.parent == parentId && treeGrid.data.haveItems(_a.id)) {
collapseTree(treeGrid, _a.id);
treeGrid.collapse(_a.id);
}
});
}
Thank you for your report.
This is known problem and it will be fixed in the next dhtmlxSuite update.
We have fixed that problem in the latest dhtmlxSuite update.
Now the collapseAll() method should work correctly.