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 1 week, 2 days ago.
- AuthorPosts
- April 24, 2024 at 1:40 pm #47918
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,
ChrigiApril 25, 2024 at 9:04 am #47928Hi 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 :)
April 25, 2024 at 9:18 am #47929Hi 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
ChrigiApril 25, 2024 at 9:53 am #47930Sorry 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”.April 26, 2024 at 4:17 pm #47953For 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 :)
April 26, 2024 at 4:20 pm #47955That 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.
April 26, 2024 at 4:45 pm #47959I 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:
Best,jQuery(function($){ let t; t = setInterval(()=>{ if ( typeof WPD !== 'undefined' && typeof WPD.dom !== 'undefined' ) { WPD.dom('.asp_option').off(); clearInterval(t); } }, 100); });
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
April 27, 2024 at 9:10 am #47964Hi 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.
April 29, 2024 at 3:58 pm #47980It’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:
Best,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); });
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.