Selected checkboxes deselect when a node is expanded in a TreeTable

Hello. I have a generated column with a checkbox in a TreeTable. If i select the checkboxes and then expand or collapse a node, the selection disappears. Is there any way to avoid that?

Thank you.

I think what happens is that the generated column is regenerated with fresh new checkboxes, and your checkboxes are initialized in unchecked state. You’d need to have a ValueChangeListener in the checkboxes and store the states somewhere, such as in a HashMap<Object,Boolean>, where you use the item ID as the key.

Thank you again Marko.