I have posted on vaadin trac suggestion (http://dev.vaadin.com/ticket/11144) for new vaadin table data model, but nobody answer my yet…
I have problem with vaadin table data binding, getters of all properties are called on table fillValues, when we have one data object with more then 200 properties, fillValues on table just takes to long, is there some smart solution for that problem ??
Read the ticket http://dev.vaadin.com/ticket/11144,… I think that solution might be just call getter of table visible properties, but when I tried to implement something like that, exceptions were occured…
Sorry, my fault, fillValues is our method which we created for fill data in table.
We create class (call it AbstractTable.class) which extends vaadin table class in which we have fillValues() method.
Example of fillValues method is:
public void fillValues() {
try{
BeanItemContainer bic = new BeanItemContainer<T>(Person.class);
for (T item : getDataList()) {
bic.addBean(item);
}
table.setContainerDataSource(bic);
table.setVisibleColumns(new String[]{"name", "surname",.....));
} catch (Exception e) {
log(sc, Level.ALL, e, true);
}
}
This seems to be due to the Table.setContainerDataSource(…) being called after the Table has been added to a layout. I guess the reason is that at this point the Table can’t know that you’re going to constraint the visible columns after setting the container, and it has to ‘get ready’ to be painted. Anyway, seems to me that there could be some optimization done about this.
Anyway, as a workaround you can make sure the table is not added to any layout when calling your fillValues() method. At least in my tests that will prevent calls to get values of non-visible properties. In other words:
When you create the Table:
Create the container and add items to it
Set container to Table
Set visible columns
Add Table to some layout
When you reset the Table container:
Remove Table from its parent layout
Create the new container and add items to it
Set container to Table
Set visible columns
Re-add the Table to the layout
I tried this on Vaadin 7.0.3 and it helped. Please let us know it it worked for you.
Thank you for your help and quick answer, you solved my problem, on vaadin 6.8.6 table is now much faster then before.
I use custom layout and right now before fillValues I do removeComponent(“table”);, and than addComponent(table,“table”); of the same vaadin table instance…
Actually when I think about it, it’s really logical right now, but before I don’t have any idea like this…