Checkboxes and async loading of children
See original GitHub issueHi,
I am loading a tree with multiple levels with checkboxes (+4000 nodes) and I use async loading. First I got an error but after monkey patching the method setIsSelected it works.
TreeNode.prototype.setIsSelected = function (value) {
if (this.isLeaf || !this.children) {
this.treeModel.setSelectedNode(this, value);
} else {
this.treeModel.setSelectedNode(this, value);
this.children.forEach((child) => child.setIsSelected(value));
}
return this;
};
But when I’m trying to check only node paths fully loaded gets selected. Any workaround for this?
UPDATE
Was able to make it work by adding this.
Object.defineProperty(TreeNode.prototype, 'isSelected', {
get: function () {
if (this.isLeaf || !this.children) {
return this.treeModel.isSelected(this);
} else {
return some(this.children, function (node) {
return node.isSelected;
});
}
},
enumerable: true,
configurable: true
});
PS: Great component all and all!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:14 (4 by maintainers)
Top Results From Across the Web
Async Data - Getting Started
The tree allows to load children asynchronously using getChildren option, and hasChildren field on the node.
Read more >jquery selecting/unselecting checkboxes in children/parent <li>
Basically, if you check a parent, all the children are selected and when you uncheck a child, all the parents associated with it...
Read more >Unconsistent behavior for selectedLeafNodeIds when using ...
Hello,. I am using a tree with checkboxes, triState and async loading (v8.4.0). I use state.selectedLeafNodeIds to get the checked items but ...
Read more >useGridList – React Aria - React Spectrum Libraries
Async loading – Support for loading items asynchronously, with infinite and virtualized scrolling. Keyboard navigation – List items and focusable children ...
Read more >Testing async stuff in React components with Jest and react ...
When data is not there yet, you may display a placeholder UI like a spinner, "Loading..." or some skeleton item. Data view. When...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@omid-nazifi you assign the node id to selectLeafNodeIds
Thanks you @wendelstam It was a great note. 👍