I have created a grid View that uses an isotope effect to relayout items when the browser changes. I recreated this View from a portfolio plugin, I copied the generated code and applied it in a View layout. I also filter the View by 2 taxonomy filters (Categories, Tags) and I have selected the option for the View to udpate results when a user input changes. When the View loads everything looks fine but when I filter with certain category the View only shows one result and any ajax functionality seems to have stopped, for instance a modal window should have opened when clicked on the title of a View item but instead it opens on a separate window. Also the reset button does not work, I need to click the menu link to go back and refresh the View for everything to work again.
It seems to be an issue with the Ajax funtionality when updating the View results after the filtering because it works fine when I select the filters to completely refresh the page and show the results afterwords. I don't see anything in the browser console either.
I have found two threads that might help you:
https://toolset.com/forums/topic/ajax/
https://toolset.com/forums/topic/need-ajax-callback-for-updating-results-when-filters-change/
I am happy to provide a test site, I would have done it here but there is no way to include a private reply in my post, maybe something for the support team to consider in the future?
I think this is pretty easy to solve. We do have some JS callback that can be used to run your custom JS after the applying the filter, for instance.
I need to request temporary access (wp-admin and FTP) to your site in order to be offering better help. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.
Also, provide the piece of code that you need to run.
As I promised, quickly fixed by adding the JS below in the View:
jQuery( document ).on( 'js_event_wpv_parametric_search_results_updated', function( event, data ) {
/**
* data.view_unique_id (string) The View unique ID hash
* data.layout (object) The jQuery object for the View layout wrapper
*/
viba_portfolio.init();
});
That's great man, thank you! Two things:
When I select a portfolio category filter it show the last item by itself for a fraction of a second before it dusplays the filtered results. Same thing when the view first loads. Also after a category filter when I click on a title and the modal pops up then click on the next arrow, there is some kind of weird refresh issue where it either shows the wrong post or it skips through the posts and shows a random one, kind of hard to explain. Just click on a post title and try skipping through the posts through the arrow. It works fine before the filter occurs.
Can we do anything about those issues?
Thanks again!
Unfortunately I don't know what to do in this case, since this is coming from the main.js file. Even when you remove the line I've added viba_portfolio.init(); in the JS section of the View, you will notice that some element loads by default before showing the other items. The best thing is to contact the developer responsible.
Please let me know if you are satisfied with my reply and any other questions you may have.
Regards,
Adriano Ferreira
I will do that, thanks for your help!