Announcement

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

    Problem in filterEditorCriteria

    Hello
    I have to decorate my filterEditorCriteria with another criteria to be calculated dinamically (I don't know that criteria in compile time); so I introduced a chunk that, in a fetch event, composes criteria with filterEditorCriteria and a prefilterCriteria.
    I saw, on SmartGwt consolle, that filterEditorCriteria is composed like an AND of Criterias (i.e: AND of filters on a listGrid); but when filterEditorCriteria was composed by one criteria I noticed that:
    Code:
    operator":"and", 
                            "criteria":[
                                {
                                    "fieldName":"fieldXYZ", 
                                    "operator":"iContains", 
                                    "value":"Nico"
                                }
                            ]
    No problem in a stand alone criteria, but in a composite of Criteria here's what happens:
    Code:
    {
        "dataSource":"TheDataSource", 
        "operationType":"fetch", 
        "componentId":"isc_CardinisListWidget_ListGridExt_2", 
        "data":{
            "query":{
                "criteria":{
                    "operator":"and", 
                    "criteria":[
                        {
                            "operator":"and", 
                            "criteria":[
                                {
                                    "fieldName":"XYZ", 
                                    "operator":"iContains", 
                                    "value":"Nico"
                                }
                            ]
                        }, 
                        {
                            "operator":"and", 
                            "criteria":[
                                {
                                    "fieldName":"OtherField", 
                                    "operator":"equals", 
                                    "value":1
                                }, 
                                {
                                    "fieldName":"status", 
                                    "operator":"notEqual", 
                                    "value":"CA"
                                }
                            ]
                        }
                    ]
                }, 
            }
    expected that operator:"and" had almost two criterias; yet there is only one.
    I do this work around
    Code:
     
    "criteria":[
                                {
                                    "fieldName":"fieldXYZ", 
                                    "operator":"iContains", 
                                    "value":"Nico"
                                },
    			    {}
                            ]
    but I ask for another possible solution.

    #2
    If by a "composite of two criteria" you mean that you called DataSource.combineCriteria(), this has been fixed within the last week - getFilterEditorCriteria() now always includes the _constructor:"AdvancedCriteria" tag which ensures that combineCriteria() does the right thing.

    Comment

    Working...
    X