Expanding table using expand button

Hey guys,

let’s say I want to have a table that displays all the search results after a search query. I add an “expand”-button at the top-right corner.
After doing the search query I want the table to show only a certain number of rows (here: only a certain number of search results). After clicking the expand-button, I want the table to expand to show all its content (here: all the search results found).
My question: Is there a way to do that in Vaadin and if so how would you go about it?
This question might have been asked before. Please let me know if this question has already been answered and where to find it.
Thanks so much in advance!

Best regards,

Paul

Hello,

Table.setPageLength() will solve the problem for you. Set page length to the number of results you want it to be initially, then on expand click set it to the number of items found. A defined table height might interfere with it, so try setHeight(null) first.

Ok, sounds good. Thanks a lot, Michael. Appreciate your help.
Is there a way to shrink the table to its initial height after expanding it, i.e. by clicking the expand-button again?

Best regards,

Paul

Just set page length back to the initial number of results, that should work.

Hope it helps.