TreeTable expandAll / collapseAll

Hi,

I need to expand and collapse all items in a TreeTable. I’m doing this by defining an extra generated column which creates an empty label, so I simulate that I have an extra column only for the expand/collapse icons. In the column header I have a Table.HeaderClickListener which onClick() should recursively expand / collapse all items by calling the method setCollapsed(Object itemId, boolean collapsed) of TreeTable. This doesn’t work: on clicking the column header the items are neither expanded nor collapsed. What am I doing wrong? How can I implement my expandAll / collapse all functionality better?

Thank you.

P.S. I’m using vaadin 6.7.2… The data container of the table is a HierarchicalContainer (and I would prefer to remain so). The table and the labels are immediate…

I’ve also tried without any generated column. I only have an HeaderClickListener which onHeaderClick() calls recursively setCollapsed(Object itemId, boolean collapsed) for all root items. This is obviously not enough, the root items are being neither collapsed nor expanded… Please help.

This might be related to
issue #7988
which is fixed and waiting for 6.7.3 release - please test with the latest nightly build to see if it resolves your problem.

Thank you for replying so quickly. It seems to be #7988. Tomorrow I will test.

I have tested my collapseAll / expandAll functionality with the latest vaadin build and it works. Thank you.

Hi ,
Ho to do it with new vaadin ?

Hello, // Expand all nodes for (Object item: ttable.getItemIds().toArray()) ttable.setCollapsed(item, false); You can do it like this.
Also, here is the full example of possible TreeTable usage.
https://dev.vaadin.com/svn/doc/book-examples/trunk/src/com/vaadin/book/examples/component/TreeTableExample.java

Hopefully, it helps : )