jakezatecky / react-checkbox-tree

A simple and elegant checkbox tree for React.

Home Page:https://jakezatecky.github.io/react-checkbox-tree/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to just get the name top level checked box

yunusyavuz16 opened this issue · comments

Hello,
first of all, thank you for creating this library.
I could not find somethin. I have treeview data like

Level1

Level2

Level3

Level4

in that way, when I checked Level 1 the checked property turns out the level4 but it does not give me the level 1 object I have to just display the name of the top object which is checked. In this example that is level 1. How can I obtain just checked box in top or just checked box name which I clicked. If there is an issue about this subject I am sorry I could not find it. Please help me :)
Kind regards.

Could you please help someone how can I keep the state of box which is checked in Level 1 or Level 2? library always gives me the level 4 state.

@jakezatecky I am in the troulbe I hope I dont bother you can you help me?

Same issue here !

@yunusyavuz16 You have to store checked data in a temporary array. Then you have to take the difference of checked and temp array and push the difference into temp array. You will get your desired value.

You could set checkModel="all", which will report all of the checked nodes and not just the leaf nodes. This would include "Level 1" in the selected array, assuming that Level 2 and Level 3 each have just one child below and those are all selected, too.

There is no support for checkModel="top" yet, but that is an on-going enhancement.