I’m developing a module using Vaadin and face the following problem with table:
My purpose:
Due to performance requirement, after user clicking on an item of table, the event should not be sent to the server immediately until user stop clicking on table in a few second (delay time).
My problem:
I see that Vaadin currently does not support this operation. I tried to implement client size widget by writing a class which is inherited from VScrollTable and create a timer to count down the delayed time.
But after investigating, I see that the click event is handled in VScrollTableRow rather than VScrollTable.
One way would be to do it server side, the only problem then is that you need to do the update from a background thread and need to use ICEPush or Refresher to get to change to the client.
Are you using ItemClickListeners or ValueChangeListener ? With ValueChangeListener (selection) and with setImmediate(true) this would be easier to implement. You could just call client.sendPendingVariableChanges() when no selections has happened for a while.
Check out how TreeTable add-on overrides the VScrollTableRow implementation to get forward. Link to sources can be found via the Directory.
Dough, should always check if someone has already replied…
Artur’s suggestion sounds quite reasonable to me too. But I’d use the built in ProgressIndicator on the first click. That way your users can immediately see that the expensive action is already pending. Otherwise they might thing something went wrong and click the row several times in row.
Due to restricted performance requirement, we have to implement this module at client size and nothing should be sent to server if the delay time has not been elapsed. So, I’ll try the the way of extending VScrollTable, VScrollTableBody and VScrollTableRow.
I’m now looking at the implementation of VTreeTable class.
I think the implementing at server side is OK if there is no requirement of limiting requests.