Search code examples
javamysqldatasourcesmartgwt

Use a criteria in a custom datasource operation


I'm a newbie using smartgwt and right now I'm having some troubles passing AdvancedCriteria from client to the server.

I did a datasource custom operation which builds a relative complex MySQL query in the server. That works fine and I can see the results in the client but my problem comes when I try to add filters to that query.

I would like to use the FilterBuilder class and pass AdvancedCriteria from client to server. My problem is that I set the criteria in the client (DSRequest object) and in the server (DSRequest object) this is empty...

Client:

DSRequest request = new DSRequest();
request.setCriteria(filterBuilder.getCriteria());
DataSource.get("datasource").performCustomOperation("doSomething", record, callback, request);

Server:

dsRequest.getCriteria()

The client is working since looking in firebug I can see the advanced criteria.

Any idea. It's actually possible to use a advanced criteria in the server?

Thanks!!!


Solution

  • There are so many values to access criteria from DSRequest.

    Try any one which is working in your case.

    dsRequest.getAdvancedCriteria()
    
    dsRequest.getAdvancedCriteria().asCriterion()
    
    dsRequest.getCriteriaValue()
    
    dsRequest.getValues()