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.

TUTORIALVaadin lets you build secure, UX-first PWAs entirely in Java.
Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Calling javascript synchronously by Enver Haase, 3 weeks ago
Table BeanItemContainer not compatible with footer
I have a table which uses BeanItemContainer to set the datasource, then when i want to add the footer, it doesn't work.
In view, initialize the table container:
informationTableContainer = new BeanItemContainer<>(Info.class);
informationTable.setContainerDataSource(informationTableContainer);
Then, add the information and add the footer:
view.getInformationTable().setFooterVisible(true);
view.getInformationTable().setColumnFooter(view.NAME, view.TOTAL_ROW);
view.getInformationTable().setColumnFooter(view.NUMBER, String.valueOf(total));
view.getInformationTable().setColumnFooter(view.TOTAL, String.valueOf(total2));
view.getInformationTable().setPageLength(view.getInformationTable().size());
The content is correct, but the footer is not shown in the table.
Can you tell me why? Thank you.
Last updated on
Hi,
Your code isn't complete. So, it's complicated to help you.
Here is an functional example (tested with Vaadin 7.4.7) :
Person class
public class Person {
private String name;
private String firstname;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
}
Testvaadin7UI class
public class Testvaadin7UI extends UI {
@WebServlet(value = "/*", asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = Testvaadin7UI.class)
public static class Servlet extends VaadinServlet {
}
@Override
protected void init(VaadinRequest request) {
BeanItemContainer<Person> container = new BeanItemContainer<Person>(Person.class);
Table t = new Table();
setContent(t);
Person p = new Person();
p.setName("dupond");
p.setFirstname("fany");
Person p2 = new Person();
p2.setName("durant");
p2.setFirstname("jacques");
container.addItem(p2);
container.addItem(p);
t.setFooterVisible(true);
t.setColumnFooter("name", "lastname");
t.setColumnFooter("firstname", String.valueOf(container.size()));
t.setContainerDataSource(container);
}
}
Last updated on
You cannot reply to this thread.