On certain occasions, I would like to specify a different target web-method for the “fetch” operation type than is specified in the DataSource. This may typically happen in different dynamic forms using the same DS but fetching the data based on different search criteria.
The DSRequest object allows the operationType name to be specified but (as far as I can see), not its value. So, I can’t see how I could specify this in the dynamic form’s fetchData method.
I don’t really want to use callOperation because I don’t want to lose the paging semantics and other benefits of going through the DS.
I have looked through the docs and searched the forum but if the answer is there, I am missing it.
I effectively want multiple wsOperations for the same OperationType.
For example, in different forms, I may want to fetch Customers by SalesManagerId or CustomerId or CustomerSurname. In my webservice, I have three Fill methods:-
I spotted operationId before I posted. Here is the help.
Perhaps its just me but, I read the above as suggesting that something can be done with the operationId to “on the server, use dsRequest.getOperationId() to detect the passed operationId and invoke the correct server code.”
I am using webservices and don’t have the opportunity to do anything with the operationId server-side. So, you don’t have to do anything to help me find the documentation. I guess the bottom line is that I don’t actually understand the documentation, at least not in my particular context ie., for web-services as opposed to a server.
Anyway, to use an American term, here’s the “skinny”, as far as I am able to understand.
When using a .NET web service (or any web service, I suppose), I needed to specify my “operationId” value in two places. First of all as an adjunct to the operationType:
addGrid.fetchData(null, function (dsResponse, data, dsRequest) {
if (data.length >= 1 ) addGrid.selectRecord(data[0]) },
{ useHttpProxy: true, operationId: "fillByCustId" } );
If I had seen code snippets like the above, as a web service user, I would have “got it” although I appreciate that this would not necessarily be the case for all users.
I noticed some other behaviour that isn’t obvious so I will pass this on in case it is not intended to be this way.
In the operationBindings code (above), the third “fetch” operationType has a wsOperation specified as “FillBySurname” but no specified operationId. If you make a fetchData() call and don’t specify an operationId, SmartClient doesn’t associate the operationId-less fetchData call with the operationId-less operationBinding (in the above example { operationType: “fetch”, wsOperation: “FillBySurname” }) – SmartClient will default to the first “fetch” operationBinding in the array of bindings.
If you specify an operationId as a request parameter that is incorrect or simply doesn’t exist in the array of operationBindings, SmartClient will again default to, in this case, the first “fetch” operationType in the array of operationBindings.
If you specify an operationId as a request parameter that is correct and can be matched to an operationBinding object in the array of operationBindings, then SmartClient will use the correct wsOperation.
So, in summary if SmartClient cannot match the operationId in a request parameter to an item in the array of operationBindings or there are more than one binding for the same operationType but no operationId is specified as a request parameter, SmartClient uses the first matching operationType it finds in the list of operationBindings.