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.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Footer for index column (RowHeaderMode.INDEX), possible?
Hello,
I have a table with an extra column showing indexes:
table.setRowHeaderMode(RowHeaderMode.INDEX);
Can I add a footer under the index column, showing the total row count?
I tried:
int rowCount = resultsList.size(); //my row count
table.setColumnFooter(null, String.valueOf(rowCount));
but it doesn't work (no number is shown). Any ideas?
Kind regards,
Jim
Hello Jim,
you can try it by doing something like this:
int number=table.getContainerDataSource().size();
//getContainerDataSourse() returns the viewing data-source container.
//.size() returns the number of visible items in the container; in your case - rows
//then ou can try by adding footer as you have done before:
table.setColumnFooter(null,String.valueOf(number))
Hopefully it will help : )
Anastasia hi,
Thanks for replying. The problem is that tha last line
table.setColumnFooter(null,String.valueOf(number))
is not doing anything under the index column.
I think that the property corresponding to the index column is not "null"
Regards,
Jim
Hello Jim,
you are right, it just can't work:
It should be something like this:
// Have a table with a numeric column
Table table = new Table("Custom Table Footer");
table.addContainerProperty("Name", String.class, null);
table.addContainerProperty("Died At Age", Integer.class, null);
// Set the footers
table.setFooterVisible(true);
table.setColumnFooter("Name", "Average");
table.setColumnFooter("Died At Age", String.valueOf(avgAge))
So you have to specify column explicitly (by name, for example) as you have mentioned.
Here is the full example of setColumnFooter usage:
https://vaadin.com/docs/-/part/framework/components/components-table.html