I have unsuccessfully spent the better of a day trying to correctly use the performCustomOperation method to invoke a custom server method. I have read and reread the documentation across the quick start guide and the javadocs as well as reviewed the discussion in threads http://forums.smartclient.com/showthread.php?t=12142 and http://forums.smartclient.com/showth...ght=custom+arg.
If I use the following datasource definition:
I get the following error:
If I use the following datasource definition:
I get the following error:
Based on the nature of these errors and the reading I have done, it appears that the first data source definition is closer to the correct one than the second.
I connect the following handler to a list grid field within a list grid and I _do_ receive the "clicked record" dialog box when I click the record:
I have also changed the name of this method to "custom" and it still is not invoked.
Can someone tell me precisely what I need to do to invoke the custom method initializeSubjects?
If I use the following datasource definition:
Code:
<DataSource ID="initializeSubjects" serverType="generic"> <serverObject ID="initializeSubjects" lookupStyle="new" className="com.clp.dear.server.ListServerDMI"/> <operationBindings> <!-- Can add method arguments with: methodArguments="$dsRequest, $dsRequest.criteria.name" --> <binding operationID="initializeSubjects" operationType="custom" serverMethod="initializeSubjects"> <serverObject lookupStyle="new" className="com.clp.dear.server.ListServerDMI"/> </binding> </operationBindings> </DataSource>
Code:
=== 2010-12-02 15:33:10,115 [90-5] WARN RequestContext - dsRequest.execute() failed: java.lang.Exception: attempt to call unknown operationType: custom at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:171) at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:64) ...
Code:
<DataSource ID="initializeSubjects" serverType="generic"> <operationBindings> <!-- Can add method arguments with: methodArguments="$dsRequest, $dsRequest.criteria.name" --> <binding operationID="initializeSubjects" operationType="custom" serverMethod="initializeSubjects"> <serverObject lookupStyle="new" className="com.clp.dear.server.ListServerDMI"/> </binding> </operationBindings> </DataSource>
Code:
=== 2010-12-02 15:26:15,152 [90-6] WARN RequestContext - dsRequest.execute() failed: java.lang.Exception: Operation type 'custom' not supported by this DataSource (initializeSubjects) at com.isomorphic.datasource.DataSource.notSupported(DataSource.java:1594) at com.isomorphic.datasource.DataSource.executeCustom(DataSource.java:1577) ...
I connect the following handler to a list grid field within a list grid and I _do_ receive the "clicked record" dialog box when I click the record:
Code:
new RecordClickHandler() { public void onRecordClick(RecordClickEvent event) { SC.say("clicked record"); DataSource ds = DataSource.get("initializeSubjects"); ds.performCustomOperation("initializeSubjects", event.getRecord(), new DSCallback() { public void execute(DSResponse response, Object rawData, DSRequest request) { SC.say("DS Callback"); // RootPanel.get().add(new Label("Response = " + (String) rawData)); } }, new DSRequest()); } }
Code:
Inside ListServerDMI I have a server side method of: public DSResponse initializeSubjects(DSRequest dsRequest) throws Exception { return fetch(dsRequest); }
Can someone tell me precisely what I need to do to invoke the custom method initializeSubjects?
Comment