Reputation: 11835
I want to use a TreeTable which some nodes in the tree will be with checkboxes and some not. My data objects are at the moment in a root java object, and already have a hierarchy. So since there are many methods to bind the data to a treetable. I am not sure which way I should choose?
Should I use a hierarchical container, Do I have to set each parent and child manually or not because it is already in a hierarchy. Should I add them as Item types or objects as they are already are, and this approach also make easy to put checkboxes to some items
Thanks
Upvotes: 1
Views: 6055
Reputation:
To bind your data with the treeTable you need to use HierarchicalCOntainer beacause the hierarchy is preserved in this container and yes you have to create the hierarchy manually.
To bind your data, you have do to the following :
hierarchical.addItem(pojo);
hierarchical.setParent(childPojo, parentPojo);
treetable.setChildrenAllowed(leaf, false);
You can found an example of databinding here.
To have your checkBoxe in your treeTable, you can do that with a GeneratedColumn.
If your not familiar with this concept, this link will help you : 5.14.5. Generated Table
Regards, Éric
Upvotes: 5