Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author Jonathandejong

    (@jonathandejong)

    Hi Maveee,

    The main reason why I’m not doing this is because it works badly with multiple filters.. say I want to filter on multiple taxonomies at once, I’ll have to wait for each taxonomy-filter to reload the page first.

    But if you want to do that you could achieve it by looking at the dropdowns .change with some custom javascript (jquery) and submit the form.
    Something like this might do the trick:

    jQuery('.beautiful-taxonomy-filters-select').change(function(){
    	jQuery('#beautiful-taxonomy-filters-form').submit();
    });
    Thread Starter Maveee

    (@maveee)

    Thank you for your extended answer!

    Plugin Author Jonathandejong

    (@jonathandejong)

    No problem, did the code solve it for you?

    If so I’d like to mark this topic as resolved ??

    Also, if you like the plugin please feel free to leave a review. It helps a lot!

    Best regards,
    Jonathan

    Thread Starter Maveee

    (@maveee)

    Marked it as resolved!
    Will do a review too.

    Hi,

    me again ^^

    this works well if I’m not using select2.
    But when I do, selecting an option, doesn’t actually change the ‘selected’ state on the ‘.beautiful-taxonomy-filters-select’

    What about now?
    Preferably select2 should update the ‘selected’ state, doesn’t it?

    Plugin Author Jonathandejong

    (@jonathandejong)

    Hi Nils,

    Which version of select2 is being loaded if you check the source?
    Select2 should respond to the .change event since when changing the select2 dropdown it programmatically changes the hidden select-element.

    You might try changing it to

    jQuery('.beautiful-taxonomy-filters-select').on('change', function(){
    	jQuery('#beautiful-taxonomy-filters-form').submit();
    });

    Hi,

    Select2 4.0.0 is loaded.

    The hidden select-input doesn’t get updated.
    Thats why your snipped doesn’t work.

    btw I try to use plain js

    var _ = require('lodash');
    
    _.map(document.getElementsByClassName('beautiful-taxonomy-filters-select'), function(element) {
      element.addEventListener('change', function(){
        document.getElementById('beautiful-taxonomy-filters-form').submit();
      });
    });

    Plugin Author Jonathandejong

    (@jonathandejong)

    Hi Nils,
    That’s very strange.. in Select2 3.x it works like a charm and in the documentation for v4 (albeit a bit lacking) it says it responds the same way to .change events..

    It’s possible that it’s a bug with the new version.
    Gonna check the github issues section to see if it’s been addressed when I find the time (you are welome to check too ?? ).

    Plugin Author Jonathandejong

    (@jonathandejong)

    Hi Nils,

    I’ve tested with 4.0.1 (select2) and it seems to be working. Will soon push out a new version 1.2.9 with updated select2.

    jquery solution does not work in 1.2.9

    Plugin Author Jonathandejong

    (@jonathandejong)

    Hi karaschenko,

    Which version of select2 is being loaded in your site? 1.2.9 should load select2 4.0.1 and in that version this should be fixed (and works when I’ve tested it).

    Could you check your source code which version is actually being loaded as it’s possible another plugin loads select2 first.

    I dont know why, but select2 didnt work width BTF at first, so i desided to install select2 manually(4.0.1) and its worked. But then I had to remove the button “filter” (project’s design), and found that solution but its not working:( Help me plz!

    Btw, thx for plugin and sry for my english(

    Plugin Author Jonathandejong

    (@jonathandejong)

    Hi Karaschenko,

    If it works when you include 4.0.1 in your theme then your problem was probably another plugin loading in select2 before BTF. Now your theme get’s priority instead.

    What have you tried and what is not working?

    Jonathan,thx, its work now, but can u help me litle more? I need to change default placeholder https://joxi.ru/Y2LKRoxunbbWPm

    Plugin Author Jonathandejong

    (@jonathandejong)

    Good to know.

    Please post a new topic regarding the placeholders so others can find whatever we conclude there as well ??

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Automatically submit filters?’ is closed to new replies.