Updating Table rows using Vaadin Data Models

Hey Guys,

First off all, I would like to congratulate you guys on what an excellent UI framework you guys have built here with Vaadin. I have used many web UI frameworks in the past 5 years, and I have to say by far Vaadin seems to be one of the best if not the best in my eyes, excellent work and wishing you guys more success in the future to come.

My question is regarding being able to update a row in a table using the Vaadin Data Models rather than using
the Refresher addon(Polling) or the Ice Push Addon(refreshing)

I would like to be able to update the rows of a table every second, so the user can see the data changes which are coming from a database in real-time.I have looked extensively through your forums which have been extremely helpful, but I have not been able to get over this particular bump on the road.

I saw in this particular forum post: http://vaadin.com/forum/-/message_boards/message/68418 that the table rows can be updated by iterating through the items in a table and modifying the specific property using setValue(), but this has not worked for me. I have been trying this method for 2 days and have had no luck. I like the idea of updating my tables this way cause since I will be updating often I believe this method will have the least overhead compared to using the polling and pushing addons technique. I have a background thread running in the background which tries to update the tables existing rows with new Data once every second, but the tables cells and rows don’t update. By debugging the code, I can see that the thread is able to access the items in the table and even update them, however the changes are not reflected in the table UI I am seeing on the browser.

I have attached sample code which is basically executing the algorithm I explained in the last paragraph. I would be truly grateful for any help I can get with this issue.

Mohamed Ahmed
11626.java (2.56 KB)
11627.java (651 Bytes)

This is still a web application, and unless the browser asks for updates (poll) or is informed of them by push (keeping an open connection), there is no way for it to know when something might have happened in a background thread.

You do need either one of the add-ons (or the progress indicator which also polls) if making updates in a background thread, including requests by other users. See
this post
for more information.

Hi Henri,

Thanks for taking the time to answer my question, I understand what you mean. For some reason, while I was going through the forums I got the impression that you can update the rows of a table by simply accessing the items of the table and then updating the properties of that item, in particular Risto’s statement in following forum post made me think that tables can be updated without refresher or ICE Push: http://vaadin.com/forum/-/message_boards/message/68418? Anyways, I have decided to use the Refresher addon, thanks again for your time and help, it is truly
appreciated.

Mohamed Ahmed

Hi,

Those issues apply on two different levels. There’s 1) the browser ↔ server level, and 2) component ↔ data model level.

The levels have some similarity: 1) normally only browser can initiate communication with the server based on user interaction, but IcePush kind of makes it possible to do the opposite as well, 2) component can read/write a data model, but changes in the data model need to be communicated to the component using a special notifier.