No filter selected by default

Home Forums Product Support Forums Ajax Search Pro for WordPress Support No filter selected by default

This topic contains 8 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 1 month, 3 weeks ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #47918
    chrigifrick
    chrigifrick
    Participant

    Hi,

    We would like to implement your filter in a blog overview, where all posts are displayed by default and above you have a filter with all taxonomies / categories and a search field.

    Currently all taxonomies / categories are selected by default, is it also possible that none is selected (but all entries are still displayed) and when clicking on a taxonomy / category only the entries of the taxonomy / category are displayed?

    Actually like in your example (https://ajaxsearchpro.com/horizontal-results-layout/) with the locations.

    Thansk for your help
    Best Regards,
    Chrigi

    • This topic was modified 2 months ago by chrigifrick .
    #47928
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Chrigi,

    Sure! You can change the checkbox default states here: https://i.imgur.com/nJYsYUi.png

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #47929
    chrigifrick
    chrigifrick
    Participant

    Hi Ernest

    Thanks a lot – Sorry I’m blind. πŸ˜…

    Is it possible that the checkboxes on the filter doesn’t change their “checked” status?
    The main problem is, that the checkboxes react to a rightclick but I don’t get a “click” event there. πŸ˜…

    I try to add some custom code when a checkbox is changed, but I don’t get it to work.

     $(document).on('change', 'input[type="checkbox"]', function () {
            console.log('change');
     });

    Thanks a lot!
    Best Regards
    Chrigi

    #47930
    chrigifrick
    chrigifrick
    Participant

    Sorry another question.

    We enablet the option “Display results by default when the page loads (auto populate)?”.
    But it looks like that the “Ordering” setting doesn’t apply at the first load.

    We chose the option “Menu order ascending”.

    I added the URL to the test website, if you click on the filter “PROFFIX” and click again you see the order is different.
    First order is “publish date” and second is “Menu order ascending”.

    #47953
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    For the initial auto populate there is a separate ordering. You can “bypass” it with this setup: https://i.imgur.com/29ETa0l.png

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #47955
    chrigifrick
    chrigifrick
    Participant

    That worked. πŸ™

    Is it possible that the checkboxes on the filter doesn’t change their “checked” status?
    The main problem is, that the checkboxes react to a rightclick but I don’t get a “click” event there. πŸ˜…

    I try to add some custom code when a checkbox is changed, but I don’t get it to work.

     $(document).on('change', 'input[type="checkbox"]', function () {
            console.log('change');
     });

    I hope that’s the last one – we will need this function for all our websites where we will have a search funciton in future.

    #47959
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    I think so, it does not use jQuery, but it’s native. However I think you can use a helper method to disregard the event handlers, something like:

    jQuery(function($){
        let t;
        t = setInterval(()=>{
            if ( typeof WPD !== 'undefined' && typeof WPD.dom !== 'undefined' ) {
                WPD.dom('.asp_option').off();
                clearInterval(t);
            }
        }, 100);
    });
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #47964
    chrigifrick
    chrigifrick
    Participant

    Hi Ernest

    I implemented the code and with the code I can’t click on any filter anymore. πŸ˜…

    Is there really no option to intercept with JavaScript or jQuery when a filter status changes?
    I feel like I’ve tried everything. πŸ™ˆ

    Otherwise I could build my desired design with CSS & JS somehow, but it would be cool if you could intercept this.

    #47980
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    It’s not that simple I’m afraid. The checkbox gets checked when the user clicks on the container “.asp_option” element.
    An event handler is attached to it (native), which then changes the checkbox property to checked/unchecked, after that it fires the following event:

    checkboxElement.dispatchEvent(new Event('asp_chbx_change'));

    However you can attach to that event:

    jQuery(function($){
        let t;
        t = setInterval(()=>{
            if ( typeof WPD !== 'undefined' && typeof WPD.dom !== 'undefined' ) {
                WPD.dom('input').on('asp_chbx_change', function(){
                    console.log('hey')
                });;
            }
        }, 100);
    });
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.