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, 2 weeks ago
Problem in implementing lazy loading in MTable from Viritin addon
Hello guys,
I'm using Varitin addon (v 1.61) in my web app. I'm trying to implement lazy loading using MTable as following:
private List<UserAccount> users = new ArrayList<UserAccount>();
users = gbemForCommonDb.getEntitymanager().createQuery("SELECT ua FROM UserAccount ua")
.getResultList();
usersMTable = new MTable(CommonUserAccount.class)
.withFullHeight()
.withFullWidth()
.withStyleName("striped", ValoTheme.TABLE_BORDERLESS, ValoTheme.TABLE_NO_HORIZONTAL_LINES, ValoTheme.TABLE_NO_VERTICAL_LINES)
.withProperties("email", "firstname", "lastname", "username")
.withColumnHeaders(GroupBuilderApp.getInstance().getTranslation("email"),
GroupBuilderApp.getInstance().getTranslation("firstname"),
GroupBuilderApp.getInstance().getTranslation("lastname"),
GroupBuilderApp.getInstance().getTranslation("username"))
.withValueChangeListener(new MValueChangeListener() {
@Override
public void valueChange(MValueChangeEvent event) {
setModificationsEnabled(event.getProperty().getValue() != null);
}
private void setModificationsEnabled(boolean b) {
editItem.setEnabled(b);
removeItem.setEnabled(b);
}
}).lazyLoadFrom(new LazyList.PagingProvider() {
@Override
public List findEntities(int firstRow) {
return users.subList(firstRow, 20);
}
}, new LazyList.CountProvider() {
@Override
public int size() {
return users.size();
}
});
usersMTable.addBeans(users);
But getting the following error in the line usersMTable.addBeans(users) :
Severe: java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:148)
at java.util.AbstractList.add(AbstractList.java:108)
at org.vaadin.viritin.ListContainer.addItem(ListContainer.java:378)
Am I doing anything wrong? If so then what is the solution then?
@MattiTahvonen it would be a great pleasure for me if you have a look on my issue :)
Thanks in advance :)
Last updated on
You cannot reply to this thread.