Search code examples
web-servicesgwtrestgwt-rpc

Strategy/pattern for committing GWT CellTable changes to server


I've got a GWT CellTable displaying data suppled from a server. As per normal, the CellTable very closely matches the backend table.

I'm unsure on a strategy for server commits. The FieldUpdater for my table expects to fire events when a single field has changed, so:

  1. should I fire individual field updates to the backend?
  2. should I queue up field commits until the user leaves that row, and then update all necessary fields in the backend? (I could highlight un-saved changes in that row)
  3. should I queue up row commits until the user presses 'Submit' at the foot of the page? (I could highlight un-saved row changes across the whole table).

Strategy 1 seems to be the GWT way. Strategies 2 & 3 incur reduced comms processing, although they need extra GWT scaffolding to be written.

Any thoughts? Have I missed any alternatives?


Solution

  • That seems like a thorough listing of the options. I'd go with #1 by default - it's simpler to code, and the user gets faster feedback. On the other hand, if you're in a situation like editing a document, where maybe the user wants a chance to compose a full response before part of it is visible to others, #2 or #3 might be most appropriate. #3 could get awkward to keep track of over multiple pages of your table. Whatever you do, make sure you have a plan in mind for a failed request.