Hello
I'm writting simple app in which my datasource comunicates with rpc service. For example my rpc send JSON object to datasource. I have problem with adding this object to my ListGrid. Below is code.
I would by grateful if you help me.
Thanks
I'm writting simple app in which my datasource comunicates with rpc service. For example my rpc send JSON object to datasource. I have problem with adding this object to my ListGrid. Below is code.
I would by grateful if you help me.
Thanks
Code:
public class JSONServiceImpl extends RemoteServiceServlet implements JSONService { public String myMethod() { return "{" + "id:1," + "name:\"Name\"" + "}"; } }
Code:
@Override protected Object transformRequest(DSRequest dsRequest) { final String requestId = dsRequest.getRequestId (); final DSResponse response = new DSResponse (); response.setAttribute ("clientContext", dsRequest.getAttributeAsObject ("clientContext")); response.setStatus (0); JSONServiceAsync service = GWT.create (JSONService.class); service.myMethod(new AsyncCallback<String> () { public void onFailure (Throwable caught) { response.setStatus (RPCResponse.STATUS_FAILURE); SC.say("Failure"); processResponse (requestId, response); } public void onSuccess (String result) { ListGridRecord r = new ListGridRecord( JSONEncoder.decode(result)); response.setData(r); processResponse (requestId, response); } }); return dsRequest.getData(); }
Comment