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.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Update and reveal row in table
Hi
I try to achieve the following:
- A table shows all available orders
- A detail pane allows to edit the details of a selected order
If the user has finished editing an order and saves his work, I would like to
1) update the data of the edited order in the table
2) and make sure that the edited order is visible in the table (the user may have scrolled the table during editing the order)
To solve the first problem, it seems necessary to use components in the table as it is otherwise not possible to update just a single row (http://dev.vaadin.com/ticket/3171) - is this correct?
Regarding the second problem, I have no idea how to solve it. The Table offers the method getVisibleItemIds(), but I did not found any setter method.
Any help appreciated,
Thomas
Thomas Mauch:
[...]
I would like to
1) update the data of the edited order in the table
2) and make sure that the edited order is visible in the table (the user may have scrolled the table during editing the order)To solve the first problem, it seems necessary to use components in the table as it is otherwise not possible to update just a single row (http://dev.vaadin.com/ticket/3171) - is this correct?
No, you can certainly update a single row, just update the properties of the item. Table will redraw all rows, though, that's what the ticket is about, but this is usually not a problem.
In your case it sounds like you want to do: when the user selects a row, get the selected item and put that in a Form that is not writeTrough. When the user clicks 'save', call form.commit() -> the table should automatically be updated.
Of course you can do it manually as well, something like table.getItem(itemId).getItemProperty(propertyId).setValue(newValue)...
Thomas Mauch:
Regarding the second problem, I have no idea how to solve it. The Table offers the method getVisibleItemIds(), but I did not found any setter method.
Use one of these:
table.setCurrentPageFirstItemId(currentPageFirstItemId)
table.setCurrentPageFirstItemIndex(newIndex)
Best Regards,
Marc