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 : )
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”
Hello Jim,
you are right, it just can’t work:
It should be something like this:
[code]
// 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))
[/code]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