Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

How to sort table when it is been rendered

Muhammad Salman
7 years ago Feb 13, 2016 6:03pm
Carlos Conti
7 years ago Feb 13, 2016 7:39pm

Hi,

if you repopulate the container the table will update, so if you want to alter the sorting of your elements and the property upon which you want to sort is not visible, then I presume you will fire the sort event via another component. So in that case if you repopulate the table container, it will update and make the same effect. So you can sort via a custom Comparator which refers to your hidden property and redo the container. That's the most straightforward solution I can think of.

As for the row styling you have a method in the Table object which allows precisely that, going down to cell level, via the property and the item id.

table.setCellStyleGenerator(new Table.CellStyleGenerator() {
        public String getStyle(Object itemId, Object propertyId) {

Hope it helps.

Carlos.