Wednesday, January 29, 2014

Appropriate server backend API design for spreadsheet like UI interface?

Hi there, 

I am working on a Web App with GWT 2.5.1. It has a Excel (spread-sheet) like interface, allows user to modify data in a table.  

I prefer in-place-edit-then-commit model than a "save" button for spread-sheet like interface. Basically, user can edit any cell, press OK to commit change. This is in contrast to the traditional "save" button after user makes all changes and then click "save" to commit changes, this approach tends to lose user updates when something goes wrong. 

The question is what my backend should look like. My thought is EntityProxy interface like this:  saveMyDomainObject(EntityProxy).  Any updates in cell table will trigger a call to this API, with GWT sends delta over the wire. It seems inefficient, because every change in each cell is a separate call to backend. But I cannot think of anything better. As I said, I prefer not to use change-everything-then-save-at-end approach. 

Here is the flow, I call the server to get the domain object entity proxy, populate the cell table; when user edits a cell, I fire the request, the changes are committed in backend. 

With request factory, after I fire a request, the proxy and request object should be thrown away, and therefore, I need to retrieve the updated object from server and store on client. This seems necessary, so that next time, when user makes another edit, I have the up-to-date proxy object to modify.  What I do not like about this approach is that I always have to keep an entity proxy object behind the UI and have to keep it up-to-date by re-retrieving from server every time user makes an update.

Any better suggestion that overcome my problem below?

Two disadvantages of my current approach,  1) too many calls to backend, each update in one cell triggers a call to backend,  2) have to keep the entity proxy around behind UI and have to keep it up-to-date by re-retrieving it from server after every single update is made. 

Thanks,
Yan

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment