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, 1 month ago
Grid reordered values
Hello,
I have an application that uses the Grid and has the setColumnReorderingAllowed() set as true. The drag and drop reordering works fine but I would like to be able to persist the changed values to a database. Unfortunately, I cannot find a way to access the reordered values of the Grid.. I've tried adding a ColumnReorderHandler but it's not recognised.
Does anybody have an idea of how to do this?
Thanks!
Thalia
Last updated on
Following code works for me:
grid.addColumnReorderListener((event) -> {
if (!event.isUserOriginated()) {
return;
}
Object arr = getVisibleColumns();
config.setColOrder(arr);
log.info("column reorder event");
this.save();
});
and:
public Object getVisibleColumns() {
List<Column> columns = grid.getColumns();
Object ids = new Object[columns.size()];
for (int i = 0; i < ids.length + 1; i++) {
ids[i] = columns.get(i).getPropertyId();
}
return ids;
}[/i]
Agata
Last updated on
You cannot reply to this thread.