Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing documentation for how to use checkbox tri-state in a custom template #937

Open
stuartngreen opened this issue Mar 13, 2022 · 2 comments

Comments

@stuartngreen
Copy link

I'm not sure if this is just missing or it can't be done, but it seems like an oversight.

I would like to use the checkboxes with the tri-state functionality (parent child relationship) but within a custom template. I tried to assign the node.toggleSelected() method to the (change) event on a checkbox in a node, but it doesn't work (the toggleSelected() method is also missing from the Tree Node API reference page but it definitely exists).

The examples on the custom templates page which contain checkboxes don't have this tri-state functionality working... any help would be much appreciated.

@madman-maverick
Copy link

madman-maverick commented Sep 26, 2022

Hi @stuartngreen,
I came across the same issue as you.
It can simply be solved by using the following template for checkbox in your node's custom template:
<input class="tree-node-checkbox" type="checkbox" (click)="node.mouseAction('checkboxClick', $event)" [checked]="node.isSelected" [indeterminate]="node.isPartiallySelected" />

Hope it helps!

@stuartngreen
Copy link
Author

Thanks @madman-maverick
I ended up writing a whole new checkbox tree because performance wasn't so good with thousands of checkboxes. But your reply will help someone I'm sure!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants