Treetable expand and collapse nodes


Could anyone tell me what’s wrong with this code please?

This produces a Treetable, but the nodes will not expand and collapse.



TreeTable tr = new TreeTable();
tr.addContainerProperty(“Projects”, HorizontalLayout.class, “”);

   HorizontalLayout planLayout = new HorizontalLayout();
   planLayout.addComponent(new Label("Plan"));
   final Object plan = tr.addItem(new Object[] {
           planLayout }, null);
   HorizontalLayout projectLayout = new HorizontalLayout();
   projectLayout.addComponent(new Label("Child"));
   final Object child = tr.addItem(new Object[] {
           projectLayout }, null);

   // build hierarchy
   tr.setParent(child, plan);