Setting page length of a TreeTable to 0 disables drag & drop

Hello,

I have a TreeTable which I want to display all nodes at once and dynamically resize when expanding or collapsing nodes. To achieve this behavior I’ve set the page length to zero by calling setPageLength(0). This works nicely but it disables drag & drop functionality because the TableDropCriterion I use determines the number of visible item IDs from the getPageLength() which is of course 0. This results in passing an empty Collection of visible item IDs to the method getAllowedItemIds which I implement to determine the allowed item IDs.

Is this the correct behavior and I’m just misusing it, or should I file a bug report?

Thanks!

Instead of using getPageLength() to determine the number of visible item IDs, why don’t you just use
getVisibleItemsIds()
instead? :slight_smile:

Note, though, that “due to historical reasons the name of the method is bit misleading. Some items may be partly or totally out of the viewport of the table’s scrollable area. Actully detecting rows which can be actually seen by the end user may be problematic due to the client server architecture. Using getCurrentPageFirstItemId() combined with getPageLength() may produce good enough estimates in some situations.”

So, I guess you’ll just have to live with a bit imperfection there, if you really want the page length to be 0.

Thank you for your response.

The problem really is that the getPageLength() is called from within the accept() method of the TableDropCriterion which is part of the Vaadin framework. I only implement its abstract method getAllowedItemIds(). In short, it’s not my code that’s causing the trouble but Vaadin’s. Unless I’m misusing it, of course.

So it’s a bug in the Vaadin implementation of TableDropCriterion or not? I think the method accept() should be implemented in the way you suggest so it would call the method getVisibleItemIds() instead of determining the number of visible IDs from the getPageLength(). Am I right?

Thanks!

I think you might be right, yes. Please
file a bug report
.

I have created the ticket
7972
.

Thanks!

Should work in the next 6.7 nightly build.