Announcement

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

    FilterEditor accumulates criteria

    SGWT 2.5 (08/31/2011)
    http://www.smartclient.com/smartgwt/showcase/#grid_autofit_filter
    If I add the following hander and press the filter Button multiple times, it can be seen that the FilterEditor accumulates the undesiredCriteria.
    Code:
    countryGrid.addFilterEditorSubmitHandler(new FilterEditorSubmitHandler() {
    	@Override
    	public void onFilterEditorSubmit(FilterEditorSubmitEvent event) {
    		Criteria filterEditorCriteria = countryGrid.getFilterEditorCriteria();
    		LinkedHashMap<String, Object> criteriaMap = (LinkedHashMap<String, Object>) filterEditorCriteria.getValues();
    		for(Entry<String, Object> entry : criteriaMap.entrySet()){  //Object is either String or ArrayList
    			 System.out.println("key="+entry.getKey() + "/" + "value="+entry.getValue()+" ("+entry.getKey().getClass()+"/"+entry.getValue().getClass()+")");
    		}
    		Criteria undesiredCriteria = new Criteria();
    		undesiredCriteria.addCriteria("undesiredCriteria", "XYZ");
    		Criteria queryCriteria = DataSource.combineCriteria(filterEditorCriteria.asAdvancedCriteria(), undesiredCriteria.asAdvancedCriteria());
    		event.cancel();
    		countryGrid.fetchData(queryCriteria);
    	}
    });
    Is this a bug/is there a way to obtain ***only*** those values that FilterEditor is actually showing without the historical ones?

    Thanks
    fatzopilot

    #2
    There is another function
    countryGrid.getFilterEditorCriteria(true);
    which solves the issue.

    Comment


      #3
      ...but introduces a new one:
      The filter editor field is empty after the fetch so that for a small change, the value has to be entered again and again.

      Comment

      Working...
      X