Announcement

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

    Possible bug with getFilterEditorCriteria(true)

    Hi,

    I believe to have found a bug that emerges if getFilterEditorCriteria(true) *with 'true' argument* is used.
    I added the following hander to the #grid_autofit_filter from the showcase:

    Code:
    countryGrid.addFilterEditorSubmitHandler(new FilterEditorSubmitHandler() {		
    	@Override
    	public void onFilterEditorSubmit(FilterEditorSubmitEvent event) {
    		Criteria filterCriteria= countryGrid.getFilterEditorCriteria(true);  
    		Criteria queryCriteria = filterCriteria; 
    
    		LinkedHashMap<String, Object> criteriaMap = (LinkedHashMap<String, Object>) queryCriteria.getValues();
    		for(Entry<String, Object> entry : criteriaMap.entrySet()){ 
    			 System.out.println(entry);
    		}
    		event.cancel();
    		countryGrid.fetchData(queryCriteria);
    	}
    });
    In the following, the Capital field is filtered for "Ha".
    It works like a normal fetch afaics if the true in getFilterEditorCriteria is ommited.

    If countryGrid.getFilterEditorCriteria(true) is used, however, the following problems emerge
    (just replace the 2nd line of the handler):

    1. Not working (FilterEditor empty):
    queryCriteria=countryGrid.getFilterEditorCriteria(true);

    operator=and
    criteria=[{fieldName=capital, operator=iContains, value=Ha}]
    -------------------------------------------------------------------------
    2. Not working (Grid & FilterEditor empty):
    queryCriteria = DataSource.combineCriteria(new Criteria(), filterCriteria);

    operator=and
    _constructor=AdvancedCriteria
    criteria=[{_constructor=AdvancedCriteria}, {_constructor=AdvancedCriteria, operator=and, criteria=[{fieldName=capital, operator=iContains, value=Ha}]}]

    -------------------------------------------------------------------------
    3. Not working (Grid & FilterEditor empty):
    queryCriteria=filterCriteria.asAdvanceCriteria;

    _constructor=AdvancedCriteria
    operator=and
    criteria=[{fieldName=operator, operator=iContains, value=and}, {_constructor=AdvancedCriteria, operator=or, criteria=[{fieldName=criteria, operator=iContains, value={fieldName=capital, operator=iContains, value=Ha}}]}]
    -------------------------------------------------------------------------
    4. Not working (Uncaught JavaScript exception [this.$cn[_3] is undefined] in http://127.0.0.1:8888/showcase/sc/modules/ISC_Core.js, line 306):
    queryCriteria = new Criteria();
    queryCriteria.addCriteria(filterCriteria);

    operator=and
    _constructor=AdvancedCriteria
    criteria=[{fieldName=capital, operator=iContains, value=Ha}]
    -------------------------------------------------------------------------
    5. Not working (Uncaught JavaScript exception [this.$cn[_3] is undefined] in http://127.0.0.1:8888/showcase/sc/modules/ISC_Core.js, line 306):
    queryCriteria = new AdvancedCriteria();
    queryCriteria.addCriteria(filterCriteria);

    operator=and
    _constructor=AdvancedCriteria
    criteria=[{fieldName=capital, operator=iContains, value=Ha}]
    -------------------------------------------------------------------------
    6. Working:
    queryCriteria= countryGrid.getFilterEditorCriteria();

    operator=and
    _constructor=AdvancedCriteria
    criteria=[{fieldName=capital, operator=iContains, value=Ha}]
    -------------------------------------------------------------------------
    7. Working:
    queryCriteria = countryGrid.getFilterEditorCriteria().asAdvancedCriteria();

    operator=and
    _constructor=AdvancedCriteria
    criteria=[{fieldName=capital, operator=iContains, value=Ha}]

    Findings summarized:
    From a Java perspective, it is not always possible the drill down to the cause of the error.
    If we compare ex. 1+6, the difference is the lacking _constructor=AdvancedCriteria map entry.
    If we compate ex. 4+6, there is now difference in the generated map.

    SGWT 2.5 nightly 2011-09-02, FF 5.0, Java version "1.6.0_26", GWT 2.3
Working...
X