TreeTable addBeanAfter/addBeanAt not working

I have a
TreeTable
that uses a custom container data source (extends
BeanContainer<String, Node>
implements
Hierarchical
, Node is a tree-like node with parent/children/etc.) The Node also has a String ‘id’ property which is used in:
[/b]setBeanIdProperty(“id”);
[/b]

addBean() works as expected by adding a bean to the end of the list of beans in the container. The resulting element shows up in the TreeTable. (also, have TreeTable.setImmediate(true))

However, the following calls seem to do nothing. There is no response and no exception thrown:


  • addBeanAfter(String previousItemId, Node bean)

  • addBeanAt(int index, Node bean)

NOTE: after calling these methods the number of itemId’s in the Container is incremented by 1 (as expected). So apparently it may not be repainting the tree?

Any suggestions? (Thanks in advance)

Hi,

those methods do not work properly for hierarchical containers. Please see
this discussion
for details. In short: the solution is to use the moveAfterSibling(…) method.

I’m not sure if there is a ticket about this already, but if you can’t find one, you might want to create one in the vaadin trac.

-tepi

Thank you Teppo! That post helped.