I have made a custom view which will show Results based on the selected expose filters.

I can access that VIEW on my local machine as: http://drupal881/home

On leftside bar, I have some filters and when I select any filter it will display results with ajax on the same page.Above Search results I have another BLOCK. I want to hide that block so that expose filter results will be seen on top.

What is the correct way to do this. Need help please.

  • Views uses a specific Ajax response, in which you can add your own Ajax commands to manipulate the browser DOM in an event subscriber, see for example drupal.stackexchange.com/a/282086/47547
    – 4uk4
    Commented Feb 5, 2020 at 19:52
  • Its quite long and complicated. No other easy way? Commented Feb 6, 2020 at 5:24
  • It's a simple module with the two files you see in the example for the Ajax solution, and an Ajax command like this: $response->addCommand(new CssCommand('.block-foo', ['display' => 'none']));
    – 4uk4
    Commented Feb 6, 2020 at 7:27
  • I got a decent solution at this link: drupal.stackexchange.com/questions/129598/…. I made my custom js file and attach it with my theme. But the code not fires when I select any option from Select Box. Can you please take a look? Commented Feb 7, 2020 at 9:50
  • This is a different approach. IMHO the server-side PHP solution I've proposed is the better one, because Ajax is a server-side technology.
    – 4uk4
    Commented Feb 7, 2020 at 9:55


Your Answer

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

Browse other questions tagged or ask your own question.