Forums › Forums › Search & Filter Pro › Problem with collapse plugin
- This topic has 5 replies, 3 voices, and was last updated 8 years, 7 months ago by Anonymous.
-
Anonymous(Private) May 9, 2016 at 1:52 pm #45081
Hi there,
First of all, thank you for a great plugin!
I seem to have a problem on this page: http://www.huisvanhetkindpajottenland.be/diensten/. I’m using your plugin with the Collapse-O-Matic plugin (https://wordpress.org/plugins/jquery-collapse-o-matic/).
When the page loads, all items (custom post types) are collapsed by the Collapse-O-Matic plugin. But when I filter them on the left side with the Search Filter Pro plugin, they suddenly all get expanded. This only happens when I filter the results with Ajax, so I guess it has something to do with the Ajax load.
I contacted the Collapse-O-Matic plugin author and got this response:
Do you have the ability to trigger a callback function after the content is loaded dynamically? You’ll need to check with your theme or Search Filter Pro plugin to see if this is so. If not, you will have to write your own callback function, but this should not be too tricky.
I don’t know a thing about callback functions, so I’m asking you ; )
Thank you so much for your reply!
Trevor(Private) May 9, 2016 at 6:23 pm #45108I have a feeling this is over my head, but this post seems to be talking about (amongst other things) this same sort of thing?
https://support.searchandfilter.com/forums/topic/ajax-checkboxes-turn-into-an-accordion/
Ross Moderator(Private) May 10, 2016 at 11:15 pm #45236Hey Stefaan
I think I know the issue – when you search using ajax, the results are reloaded.
However, in addition to this, the search form is also reloaded (for updating dynamic fields etc).
What you will need to do is, detect when S&F has finished loading the results via ajax, and then re-apply your “Collapse-O-Matic” code to the newly loaded in results.
We do have an event/callback for this – check the first question here for the JS event:
http://www.designsandcode.com/wordpress-plugins/search-filter-pro/faqs/Thanks
Anonymous(Private) May 11, 2016 at 8:52 am #45251Hi there Ross, thank you for reaching out!
I just got a reply from another Collapse-O-Matic plugin author, with a javascript file I had to enqueue. Everything works perfectly now! A link in case anyone else encounters this problem: https://wordpress.org/support/topic/collapsed-text-expands-when-filtered-with-ajax?replies=5#post-8388668
Thank you for your support!
Stefaan -
AuthorPosts