Duration field in table

Hi guys,

I’d like to display a duration field in a table (that also displays start / end time). The problem I’m having is that the duration should count up as long as the task has not finished (end time not set), that is the GUI should show an update every seconds. However, I don’t want the whole table to be pushed every second just to show the correct duration.

Is there any (read simple) way to do this entirely on the client?

Thanks!

Hi,

I don’t think there’s any simple way to do this. The table is not able to update a single cell just by its own, and still it would require a server round-trip at least every second. You might want to look into creating your own Label-like widget, but one which would be aware of its content as a time stamp. Then you could just run a timer on the client side and update the text contents as needed. Eventually there should ofcourse be a refresh that would fetch the actual state/value from the server and display it.

You might want to look at the source code of
https://vaadin.com/directory#addon/countdownclock
for some inspiration.

Thanks a lot for your suggestions, I will look into that, seems like a good way to do it…