I'm using TreeView with checkboxes and on initial rendering I'm getting ID's from database and by those ID's I'm checking treeView items. But I found an issue, the tree node won't be marked as checked if it's not expanded before selectedNodes or .checkAll() apply.
Query: How to programmatically mark node as checked even if it is not expanded.
We have also provided the option to check the non-expanded child node while enabling the loadOnDemand. This support will be available in our upcoming volume 1, 2019 release which is expected to be rolled out in the month of March, 2019.
Please let us know if you require any further assistance.
DODomantasFebruary 15, 2019 02:54 AM
Thank you for your answer, it solved the issue.
I got one more question with TreeView. I do change autoCheck while being in action. And the problem is that if selected parent has no selected childs it will get unchecked.
Query 1: How do I maintain same selectedNodes before autoCheck and after autoCheck. For example if I still want parent to maintain selected and be in selectedNodes even if it has no selected child
Query 2: Can I somehow get rid of "mixed" status and leave just checked and unchecked
In example we got 2 parents selected, one parent has selected child another one doesn't.
This is what happens when I apply this.treeView.autoCheck = true. Parent that had selected child gets "mixed" status, but the one that didn't selected child gets unselected. And now selectedNodes before autoCheck and after autoCheck are different, but I only changed the property.
POPrince Oliver Syncfusion Team February 18, 2019 07:08 AM
Thank you for your update.
While enabling autoCheck option, the parent node will be in the checked state, only if all the child Nodes are checked. Otherwise it will be in mixed state, even if any one of its child items are not checked. This is the default behavior of TreeView when the autoCheck property is enabled.
If you still want to maintain the parentNode in checked state, you need to push the parentNode into the checked node before enabling the autoCheck property. But this will select all the child nodes of specific parent node.