Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Passing Criteria in RPC-DMI call

    v9.1p_2014-03-18/Pro Deployment (built 2014-03-18)

    I would like to pass a client side AdvancedCriteria via RPC-DMI to a server side method.

    Isomorphic documentation at http://www.smartclient.com/smartgwtee/javadoc/com/smartgwt/client/docs/DmiOverview.html has an example of passing arguments using RPC DMI. That's exactly what I need but require an argument of AdvancedCriteria type be added to the method signature.

    Can you tell me how to go about this ? I cant figure out how to handle the serialization/deserialization/conversion from client side to server side representation of the AdvancedCriteria argument ?

    Thanks

    #2
    Passing Criteria in RPC-DMI call

    While I have only done limited testing it looks like the way to pass a advanced criteria as a RPC DMI argument is to pass the criteria as a map (obtained from the AdvancedCriteria getValues() method )

    On the server side the map argument can be converted to a server side AdvancedCriteria by calling AdvancedCriteria.fromCollections( <server method formal arg>)

    The JS to Java DMI type conversions are documented in the RPCRequest API doc

    It very simple but I pretty much had to read through the various APIs to figure this out.

    Code:
    ------ Client Side DMI call
    AdvancedCriteria ac  = ...
    
    DMI.call(appID,className,methodName,callback,
                 new Object[] { ac.getValues() }
    
    ---- Server Side method
    
    public List<LinkedMap> someMethod(Map criteriaMap) {
    
    AdvancedCriteria criteria = AdvancdeCriteria.fromCollections(criteriaMap)
    Thanks again to isomorphic for the help

    Comment

    Working...
    X