TreeTable number of visible rows available?

Is there a way to get the number of visible rows in the TreeTable? That is, it would be the sum of parent nodes plus any rows that become visible when a parent node is expanded. I’d like my TreeTable view to show all rows, but keep it compact when parent nodes are not expanded/open (typical usage). However, when a parent is opened, I’d like to expand via setPageLength(int) so that it shows all of the child rows, too.

Hi,

currently there is no way to get the visible row count (apart from iterating all items and counting yourself…). However, there is a Collapsible interface (com.vaadin.addon.treetable.Collapsible) in TreeTable add-on which is defined to function just as you specified. Unfortunately the only implementation that I’m aware of seems to be a file system container. Looks like you’re going to have to implement this yourself for now.


Tepi

Created a test for this at http://dev.vaadin.com/browser/versions/6.7/tests/src/com/vaadin/tests/components/treetable/KeepAllItemsVisible.java
There seems, however, to be a problem implementing it this way as the pagelength is not updated correctly (
#7292
)

Thanks for preparing some example code. That will be a big help once the bug report you filed is resolved (thanks for that too!). I look forward to it because it will make things prettier in various scenarios including tables with just one or two top level nodes (where expanding creates scrollbars, but the “view” in is only 1-2 rows tall) or when expanding the last row (and then you have to scroll to see what you just opened.

We love the TreeTable, though. It’s so handy for showing correlated data (main record with subrecords). Is there any way to get notified when your ticket is resolved? I know the creator gets an auto-email, but I can latch on in some way, like adding a comment to the ticket or anything?

Thanks all!

You can add your e-mail address to the Cc: field of the ticket or comment on the ticket if necessary.