Loading...
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.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Update and reveal row in table

Thomas Mauch
1 decade ago Apr 21, 2010 6:48am
Marc Englund
1 decade ago Apr 21, 2010 7:37am

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