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

    ListGrid Clear Filter Event Handler

    Version: v12.1p_2021-07-21/Enterprise Deployment
    Browser: Chrome(latest)

    Is there currently a way to intercept an event from when a user clicks the 'Clear Filter' MenuItem from the context menu of the filter button in the top right of a ListGrid? (Please see attached image). Additionally, is there currently a way to programmatically set a column's filter type? We have attempted to use setFilterOperator method for the columns respective ListGridField, but it did not seem to take affect after the grid has loaded. The following showcase can be used to look at these functionalities:

    Our end goal with this request is to set the filter operators back to default after a user uses the clear filter button in the grid.

    Thank you for your time.
    Attached Files

    You could use the CriteriaChanged handler:

    Although, if what you really want is to allow users to go back to the original criteria, we would recommend either:

    1. having your own menu item or button for that, so Clear Filter still works


    2. specifying your criteria as listGrid.implicitCriteria, so they can never be edited or cleared

    As far as changing the operator, if you apply criteria and they are editable by the FilterEditor, you should find that the operator just switches. But you can also change listGridField.operator via setFieldProperties() - this is in the underlying docs but got munged by JavaDoc, we'll fix that.


      We were able to use a separate button to reset the filter operators per field using your advice. However, using the CriteriaChanged handler did not work for us to get the clear button assigned to the ListGrid's filter editor to work. The clear button in question was attached in the screenshot in case I described it incorrectly.

      For reference, we had our grid's class use the interface, and added the following override method:

      public HandlerRegistration addCriteriaChangedHandler(CriteriaChangedHandler handler)
      return addHandler(handler,;

      Then we tried using this with:

      addCriteriaChangedHandler(event -> {
      // Custom Clear

      When debugging this it appeared that the event handler was never reached. Do you have any recommendations for us to get this to work?
      Attached Files


        We were referring to this 13.0+ API. There's actually no CriteriaChanged handler for grids in 12.1 - the one you've tried to use is for forms.

        So, you'll need to do this another way - for example, you could detect null criteria in a FilterEditorSubmitHandler, like this:

        grid.addFilterEditorSubmitHandler(new FilterEditorSubmitHandler() {
            public void onFilterEditorSubmit(FilterEditorSubmitEvent event) {
                if (event.getCriteria() == null) {
                    // "Clear Filter" was just clicked (or the filter was cleared in some other way)