Announcement

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

    Programmatically reset filterOperators

    Hi,
    What is the way to programmatically reset filterOperators?
    Scenario is that the user is able to reset grid's filterEditor to initial state (including clear field operators if any set), by button click.
    Thanks,
    MichalG

    #2
    So I extended ListGrid with these methods:
    Code:
        public native void clearFieldSearchOperator(String fieldName) /*-{
            var self = this.@com.smartgwt.client.widgets.BaseWidget::getOrCreateJsObj()();
            self.clearFieldSearchOperator(fieldName);
        }-*/;
        
        public void clearSearchOperators() {
            for (ListGridField field : getFields()) {
                clearFieldSearchOperator(field.getName());
            }
        }
    HTH
    MichalG

    Comment


      #3
      If you need to reset this filter operator you should call listGrid.setFieldProperties, as in this example:

      Code:
      listGrid.setFieldProperties(fieldName, {operator: null});
      That way not only the operator and the operator icon will be reset, but also the filter value if the operator needs it (for instance, "iStartsWith")

      Comment

      Working...
      X