{
type : 'button',
ref : 'expandToLeaves',
icon : 'fa fa-angle-double-up',
text : 'Expand to leaves',
onAction : async () => {
const toCollapse = [];
await tree.expandAll();
tree.store.traverse(record => {
if (!record.isLeaf && record.children?.some(child => child.isLeaf)) {
toCollapse.push(record);
}
});
for (const record of toCollapse) {
await tree.collapse(record);
}
}
},
When I open the example my viewport is such that I only see the top 8 rows (out of 27).
What happens is that if i press the expandToLeaves-button without first scrolling down in the grid then the lowest leaf parent is not collapsed. If I try again but first scroll down to the bottom then the button works as expected.
I have tried to reproduce this in the example but I haven't been able to. Can you please let me know if I am missing anything here (Have attached the video for reproduction steps)? Moreover, let us know the browser and OS you are facing this issue on.
Hi,
It somehow did not work when I tried to reproduce it just now, but when I added another group (Gates 11 - 15) a similar error appeared. I made a recording and attached it.
{
type : 'button',
ref : 'expandToLeaves',
icon : 'fa fa-angle-double-up',
text : 'Expand to leaves',
onAction : async () => {
const
{ store } = tree,
toCollapse = [];
await tree.expandAll();
store.traverse(record => {
if (!record.isLeaf && record.children?.some(child => child.isLeaf)) {
toCollapse.push(record);
}
});
// Batch all collapses under a single store event suspension so the row manager
// receives one full refresh instead of sequential per-node remove events. The
// individual events cause virtual-row recycling to assign DOM rows to wrong
// records for nodes that are outside the current viewport.
store.suspendEvents();
for (const record of toCollapse) {
store.toggleCollapse(record, true);
}
store.resumeEvents();
tree.refreshRows();
}
},