views:

235

answers:

1

First let me warn readers not to pass me off to any links in isomorphic because it is highly probable I have read it and I have scoured the smartgwt showcase running locally here as I ask this question. What I ask is not documented and if it is, I am unable to decipher and need actual explanation here. No, do not tell me about SmartGWT EE. This case is purely Smartclient interacting with my JSP (or perl, php) on the server side, which I use to interact with a SAS backend.

This question has nothing to do with how to operate SAS. I am mentioning SAS to illustrate the point that smartclient has to interact with SAS web service directly and not through SmartGWT server. I asked a similar but different question at smartclient forum which is still unanswered, so this must be a very difficult subject that probably even people at isomorphic does not have an answer.

I have

  • JSON xjsondatasource url produced from a SAS web service, sasxjsondsrc. I am mocking it with a JSP on Jetty.
  • sasxjsondsrc = id(primaryKey), name, description.
  • ListGrid whose datasrc is set to sasxjsondsrc.
  • SearchForm/DynamicForm editForm whose datasrc is set to sasxjsondsrc.

I need to

  • user would visually select a row on listGrid and then click del button, which my code would trigger listGrid.removeSelectedData(), which would then remove only that row locally and as well as send to sasxjsondsrc url the parameters id=id to be deleted, operation=DEL.
  • user would visually select a row on listGrid and then click modify button, which my code would editForm.editSelectedData(). When user presses save edit button, my code would trigger editForm.saveData(), which would then modify that row locally and as well as send to sasxjsondsrc url the parameters id=id, name=modified-value, description=modified-description, operation=MOD.
  • user would click add button and my code would trigger editForm.saveData(), which would then append that row locally and as well as send to sasxjsondsrc url the parameters name=new-name, description=new-description, operation=ADD.

This local-server management is what smartclient advertises itself as an advantage. The problems are

  1. my JSP is not registering smartclient sending any parameter to indicate what operation should be performed. It is only receiving the datasource fields=values as parameters for the affected records.
  2. the records are not appended or modified locally for add or edit operations.
  3. to overcome problem (1), I tried providing an extra non-displayed datasource field called operation. But when a dynamic form is bound to that datasource, the dynamicform field would not allow me to programmatically modify the operation field successfully.
  4. I tried appending operation as a DSRequest but my JSP is not receiving it either.

HOW does my JSP know what operation (ADD/REMOVE/EDIT) is being performed?

OK, to cut a long story short - datasource in SmartGWT is a horribly tricky business. I have been advised to use SmartGWT only for its UI but I should avoid using SmartGWT datasource because it is too tricky to deal with. Could some post or link me to examples of how you did your SmartGWT client programming in a configuration similar to mine.

Should I revert to using GWT 2.1M3 cell/page architecture and write my own rpc-table cells-form linking?

+2  A: 

I think that you do actually need to be looking at the SmartGWT data sources, specifically the RestDataSource and quite possibly, the DataSource.setOperation() method.

Gwyn Evans