Vaadin - How add checkbox component to a tree? -


i'm using vaadin 7.5.3 develop web application. there need tree selectable nodes. want select nodes using checkboxes. after trying many ways , goggling, not find how add checkbox component tree node.

as per knowledge, current latest version aka vaadin 7.5.6, not possible, jouni point out in discussion on forums. has opened an improvement ticket don't see changes far.

nonetheless, should able fake using treetable component. can find here complete example, , below excerpt it:

final treetable ttable = new treetable("my treetable"); ttable.addcontainerproperty("name", checkbox.class, ""); ttable.addcontainerproperty("city", string.class, ""); ttable.setwidth("20em");  // create tree nodes ttable.additem(new object[]{new checkbox("root"), "helsinki"}, 0); ttable.additem(new object[]{new checkbox("branch 1"), "tampere"}, 1); ttable.additem(new object[]{new checkbox("branch 2"), "turku"}, 2); ttable.additem(new object[]{new checkbox("leaf 1"), "piikkiƶ"}, 3); ttable.additem(new object[]{new checkbox("leaf 2"), "parainen"}, 4); ttable.additem(new object[]{new checkbox("leaf 3"), "raisio"}, 5); ttable.additem(new object[]{new checkbox("leaf 4"), "naantali"}, 6);  // set hierarchy ttable.setparent(1, 0); ttable.setparent(2, 0); ttable.setparent(3, 1); ttable.setparent(4, 1); ttable.setparent(5, 2); ttable.setparent(6, 2);  // expand tree ttable.setcollapsed(2, false); (object itemid: ttable.getitemids())     ttable.setcollapsed(itemid, false);  ttable.setpagelength(ttable.size()); 

and output

checkbox in tree


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -