Hi,
Scenario is as follows. I have a ListGrid with a datasource defined, then I'm selecting a row in the grid and clicking button which passing selected record to the ServerObject call (lookupStyle="spring").
The spring bean method doesn't fit int any of fetch/add/update/remove convention and it returns object of custom class type. The returned object is heavy and can't be serialized as a whole (I don't even want to try that despite the fact that isc serializer falls into recursion on it).
Main things I would like to achieve is to keep SmartClient built-in auto-serialization for fields only specified in the datasource and auto-refresh of the grid record on response while keeping code clean as possible.
There are at least three ways I know of with which I can try to call the server side spring bean method:
1. DMI.call('appId', 'serverObjID', 'visibleMethod', record)
2. datasource.performCustomOperation('customOperationId', record)
3. datasource.updateData(record, callback, {operationId: 'updateOperationId'})
I tested all three above approaches with enough of XML config (app/ds) to get them working and got into results:
Ad.1. This solution is most desirable with usage of <isc:loadDMIStubs/> in terms of clean code, but the call fails as serializer tries to serialize whole returned object. Besides I don't expect auto-refresh would've worked even when serialized object received as there is no reference between datasource and the server call.
Question: Is there any way of using DMI.call() to get only defined fields serialized and also to get a record in the grid auto-refreshed?
Ad.2.
This solution would be good enough, but again. Serializer tried to serialize the whole returned object despite the call goes through datasource.
Question: Is there any way to make operationType="custom" binding serialize only fields defined in datasource from returned object? (I have most hope for this one)
Ad.3.
This solution works fine, but in terms of clean code it's the worst one. The 1st reason is because my operation isn't an typical 'update' so it may leads team mate/maintainer into confusion. 2nd reason, operation id has to be passed as string for every call in the code, which may easy lead to typo - which tiggers MethodMissingException on a server side, or even worse - for SQL datasource type, a direct SQL update will be triggered. Moreover it's not convenient for refactoring and maitenance.
Question: Maybe there is a way to define some kind of an alias for updateData() with operationId so the call on a datasource may look like: datasource.serverMethodName(record) ?
SmartClient version 8.3 PE
Scenario is as follows. I have a ListGrid with a datasource defined, then I'm selecting a row in the grid and clicking button which passing selected record to the ServerObject call (lookupStyle="spring").
The spring bean method doesn't fit int any of fetch/add/update/remove convention and it returns object of custom class type. The returned object is heavy and can't be serialized as a whole (I don't even want to try that despite the fact that isc serializer falls into recursion on it).
Main things I would like to achieve is to keep SmartClient built-in auto-serialization for fields only specified in the datasource and auto-refresh of the grid record on response while keeping code clean as possible.
There are at least three ways I know of with which I can try to call the server side spring bean method:
1. DMI.call('appId', 'serverObjID', 'visibleMethod', record)
2. datasource.performCustomOperation('customOperationId', record)
3. datasource.updateData(record, callback, {operationId: 'updateOperationId'})
I tested all three above approaches with enough of XML config (app/ds) to get them working and got into results:
Ad.1. This solution is most desirable with usage of <isc:loadDMIStubs/> in terms of clean code, but the call fails as serializer tries to serialize whole returned object. Besides I don't expect auto-refresh would've worked even when serialized object received as there is no reference between datasource and the server call.
Question: Is there any way of using DMI.call() to get only defined fields serialized and also to get a record in the grid auto-refreshed?
Ad.2.
This solution would be good enough, but again. Serializer tried to serialize the whole returned object despite the call goes through datasource.
Question: Is there any way to make operationType="custom" binding serialize only fields defined in datasource from returned object? (I have most hope for this one)
Ad.3.
This solution works fine, but in terms of clean code it's the worst one. The 1st reason is because my operation isn't an typical 'update' so it may leads team mate/maintainer into confusion. 2nd reason, operation id has to be passed as string for every call in the code, which may easy lead to typo - which tiggers MethodMissingException on a server side, or even worse - for SQL datasource type, a direct SQL update will be triggered. Moreover it's not convenient for refactoring and maitenance.
Question: Maybe there is a way to define some kind of an alias for updateData() with operationId so the call on a datasource may look like: datasource.serverMethodName(record) ?
SmartClient version 8.3 PE
Comment