Announcement

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

    SmartGWT filters

    i am using SC_SNAPSHOT-2011-01-05/PowerEdition Deployment (built 2011-01-05), and GWT2.2
    I was looking for the filters and found that the RPC request made by filter to fetch the results from server side in JSON format is-

    Code:
    {
        "actionURL":"http://dev.obs.amsoft.net:8123/CMPS/cmps/sc/IDACall",
        "showPrompt":true,
        "prompt":"Finding Records that match your criteria...",
        "transport":"xmlHttpRequest",
        "promptStyle":"cursor",
        "params":{
            "operator":"and",
            "_constructor":"AdvancedCriteria",
            "criteria":[
                {
                    "fieldName":"linked_positions",
                    "operator":"iContains",
                    "value":"463"
                },
                {
                    "operator":"iContains",
                    "fieldName":"contract_manager_id",
                    "value":"84"
                }
            ]
        },
        "httpMethod":"GET",
        "bypassCache":true,
        "callback":{
            "target":[DataSource ID:3pc_sp_details],
            "methodName":"$50e"
        },
        "willHandleError":true,
        "clientContext":{
            "requestIndex":2,
            "$69t":null
        },
        "data":null
    }
    Here we can see that it will fetch all rows which has linked_positions As SUBSTRING("operator":"iContains") of '463' AND contract_manager_id As SUBSTRING of '84', (here i filtered with the value 463 in linked_positions column and contract_manager_id was already in criteria which is not a primary key.)

    here is the problem- i have two rows with contract_manager_id as 184 and 84,

    Code:
    mysql> ******
    +-----+----------------------+
    | ID  | contract_manager_id  |
    +-----+----------------------+
    | 184 | HSTP                 |
    |  84 | NOS                  |
    +-----+----------------------+
    and when i filter with linked_positions value, it will look into both contract manager's.
    what i want is that it should fetch all rows with linked_positions AS SUBSTRING of '463' AND contract_manager_id as EQUALS to '84',


    Let me know if need more info.
    Last edited by arunkk; 16 Jan 2012, 21:42.

    #2
    Ok, with the help of AdvancedCriteria i can add EQUALS operator -

    Code:
    		spList.addFilterEditorSubmitHandler(new FilterEditorSubmitHandler() {
    			public void onFilterEditorSubmit(FilterEditorSubmitEvent event) {
    				Criterion[] aCri = { new Criterion("contract_manager_id", OperatorId.EQUALS, "84"), new Criterion("linked_positions", OperatorId.CONTAINS, "463")};
    				Criteria c = new AdvancedCriteria(OperatorId.EQUALS, aCri);
    				spList.setCriteria(c);
    			}
    		});
    will give me this JSON--

    Code:
    11:58:20.319:TMR9:WARN:DynamicForm:isc_DynamicForm_0:Dynamic Form editing advanced criteria object:{
        __gwt_ObjectId:2967, 
        operator:"equals", 
        criteria:[
            {
                __gwt_ObjectId:2964, 
                fieldName:"contract_manager_id", 
                operator:"equals", 
                value:"84"
            }, 
            {
                __gwt_ObjectId:2965, 
                fieldName:"linked_positions", 
                operator:"contains", 
                value:"463"
            }
        ], 
        _constructor:"AdvancedCriteria"
    }.
    but what to do after this? i mean how do i get the values entered into filter and when should i do this(is addFilterEditorSubmitHandler ok?).

    Comment


      #3
      and i am not able to see javascript:isc.showColsole() on firefox8.0 using ubuntu 11.10 :(
      working on chromium 15.0.874.106 (Developer Build 107270 Linux) Ubuntu 11.10.

      Comment

      Working...
      X