1

I have textfield as exposed filter in table view. How I can apply that filter without pressing apply button. any contrib module or suggestion?

3 Answers 3

1

Try this It may solve your problem. It may not be the proper solution but it will help you apply filter without having to click on apply button.

(function($) {
  $(document).ready(function() {
 $(document).ajaxComplete(function(event, xhr, settings) {
 $(".views-exposed-form .form-select").change(
         function(){
           $(".form-submit").click();
         }
);
  });
       });
})(jQuery);
1

In the select.html.twig, override this line:

<select{{ attributes.addClass(classes) }}>

with this line:

<select{{ attributes.addClass(classes) }} {{ attributes.setAttribute('onchange', 'this.form.submit()') }}>

This is to add the attribute of onchange to the select tag, and if there are any changes of the selection, submit the form. Therefore no need to click the Apply button.

As for the Apply button, just add a css property { display:none; }

That should do it.

0

In Drupal 7, that functionality was provided by the CTools module. In Drupal 8, it was dropped in the port of Views to core, but raised as an issue which has yet to be resolved. You should provide your feedback in that issue if you would like to see this added to Views in core.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.