You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<script>
let data = [{"id":1,"text":"Home","checked":true,"children":[{"id":7,"text":"TimeTable","checked":true,"children":[{"id":8,"text":"Staff Att","checked":true,"children":[]}]}]},{"id":2,"text":"Student","checked":true,"children":[]},{"id":3,"text":"Staff","checked":true,"children":[]},{"id":4,"text":"Library","checked":true,"children":[{"id":9,"text":"Book Issue","checked":true,"children":[]},{"id":10,"text":"Book Return","checked":true,"children":[]},{"id":11,"text":"Book Fine","checked":true,"children":[{"id":12,"text":"Fee Payment","checked":true,"children":[]}]}]},{"id":6,"text":"StudentAtt","checked":true,"children":[]}]
let tree = new Tree('.treeContainer', {
data: [{ id: '-1', text: 'root', children: data }],
closeDepth: 3,
loaded: function () {
},
onChange: function () {
console.log(this.values);
}
})
</script>
`
All nodes are checked by initial data, but 2 nodes "Book Issue" and "Book Return" are not checked, very strange.
Can you check it, please? Thank you.
The text was updated successfully, but these errors were encountered:
Every "checked: true" is handled like a click on the node.
If you start with a completely unchecked treeview and click on Library, all subnotes are checked. If you also click "Book Issue", it becomes unchecked again.
Same with "Book Fine", but it is checked again when you click on "Fee Payment".
Solution: Set "checked: true" only for the node that should really be selected (e.g. "Fee Payment" and not "Book Fine" or "Library").
But I would guess that this is a bug and not intended...
only set checked=true on nodes that do not have children on their own because their checked / half checked / not checked status is inherited by the sum of checked children
Inside the Tree.parseTreeData one may add
- if (node.checked ) values.push(node.id);
+ if (node.checked && (!node.children || node.children.length === 0) ) values.push(node.id);
Hello,
Strange problems, please see code bellow
`
<title>All nodes are checked by initial data, but 2 nodes "Book Issue" and "Book Return" are not checked, very strange.
Can you check it, please? Thank you.
The text was updated successfully, but these errors were encountered: