Comments (8)
If this is the case then only option that I can recommend you as of now to add virtualization yourself .
from react-checkbox-tree.
I never imagined this component having more than 10k nodes, but if we can get better performance, then I am all for it. There are two main areas in which performance takes a hit:
- The in-memory calculations for checking/unchecking and expanding/collapsing nodes
- The actual rendering of the DOM objects
The latter case would likely benefit from virtualization. There was a previous issue dedicated to performance that was resolved, but that mostly dealt with vastly improving the first point by reducing the calculation complexity from O(n*n) to O(n).
I'll keep this open, because I agree that virtualization of the nodes not visible in the viewport would be useful, I just have no idea how that would happen.
from react-checkbox-tree.
Hey,
I have implemented the Virtualization in my project for tree but it is not generic and am not allowed to share, company policy . Would like to share the key steps and approach.
- Removed all
<ol> , <il>
and child rendering code. Instead of this just added div for each node in TreeNode.jsx file. - Added two new props in NodeTree.jsx .
a) rowIndex : its a numeric props helps in placing the row. Suppose index is 2 then it must be the second row to be displayed. For this row top = rowHeight * 2.. and so on for other rows
b) level : it is used to add empty space at the start of the row. so it will appear as the child . - How am deciding rowIndex and level values from props Nodes.
a) rowIndex :- Before rendering of checkBoxTree.jsx, looping through the props nodes and adding one new property rowIndex only when the expanded is true for that node. So that I can pass it to the TreeNode.jsx as a props.
b) In componentWillProps method of checkBoxtree.jsx , adding the level to each node as property with the level in incremental order by looping through the node props . Like if top most parent then 0 . second top most then 1.. . and so on . - Calculation of number of rows to be displayed and start rowIndex and lastRow index to be displayed as per the screen size.
a) Calculation of number of rows to display :- containerHeight / each row height
b) Calculation of start rowIndex and lastRowIndex to display : Calculating as per the position of scroll bar. Example if position of scroll bar is top is 0 then start rowIndex would be 0 and lastRow depends on the height of container.
One more thing I have done to improve the performance is to load child nodes using service call when user click on expand icon.
fetching the data from backed and displaying as childnodes on expand click.
from react-checkbox-tree.
I am facing the same issue with about 50k nodes in tree. I have also implemented the same behaviour that onExpand, an ajax call is made which brings the child nodes and a new tree is rendered again. But, this does not solve the problem of poor performance.
Can someone suggest any virtual dom / virtual scroll plugin which can be easily integrated with the tree plugin ? Or is there any ETA on when this feature will be integrated in this plugin ?
Thanks
from react-checkbox-tree.
Hi Chirag,
Below link would help you. It has Virtualization and expand collapse.
https://mleibman.github.io/SlickGrid/examples/example5-collapsing.html
from react-checkbox-tree.
@harit2101 I need an virtual scroll integration with the checkbox tree plugin as I have gone way too far with the implementation in my project and using other plugin for listing a tree is out of question as of now.
from react-checkbox-tree.
@harit2101 I am just curious. Are all nodes at the same level ? How deep is the nested tree ?
from react-checkbox-tree.
I write this just as an idea for the owner of this repository (Not a solution for this directly for most users.)
In my case, the speed problem happend when I opened or closed a tree level with several thousand items. I reviewed the source code and found that all the item has its own ref so that any mass operation took place for all of them independently. After finding this, I made my own stuff similar to this, but the difference was I made a in put a table inside so that show/hide runs by changing only one parameter instead of all. Another change I made on my company stuff was to divide the number of units in one upload so that thousands cannot appear under one parent.
This is applicable to my case because I don't have "delete" in the tree; users delete items in the tree by checking items in the tree and clicking "delete" button outside the tree.
from react-checkbox-tree.
Related Issues (20)
- using node and nodes with checked event HOT 1
- remove icon HOT 1
- multiple checkbox selection disable HOT 3
- Unable to get just the checked parent value if all the childrens are selected rather than getting all checked values HOT 1
- stop checked value clear when refresh HOT 1
- select parent value only
- checked parent programatically
- Does this library have built in function for filtering?
- Inconsistent Id between render HOT 2
- After filtering, is it possible for all parent nodes of filtered nodes to be expanded? HOT 1
- When a parent is checked is it possible to expand all its children nodes HOT 1
- When I input the filter , icon
- Enable the check only at last level parent node and child nodes HOT 2
- Any plan to update npm? HOT 1
- css is not loading properly HOT 2
- Icon option for disabled HOT 2
- Handling for having a single node in multiple separate branches of the same tree.
- Add the ability to create files and folders
- async loading support HOT 1
- Add half checked icon to parent element with some checked children HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-checkbox-tree.