I have a view that uses a shortcode I developed called [be_get_connection] that calculates how well the user matches another user. It is registered in Toolset settings. When displaying the view, it has been working great. However, I've just noticed that whenever you apply a filter using the search (which is set to update whenever a filter value is changed), the shortcode suddenly stops working. Is there a reason for this? Attached are two screenshots - one when the page first loads and the second is after you check one of the filters.
I can successfully correct the problem if I switch from using AJAX auto-update to doing a full page refresh after clicking a submit button, but I would rather use AJAX so I figured I'd check in with you before I go around updating all the search pages throughout my site (I want consistency on how all the views look and feel). Thanks for any insight.
- Aaron
Yes, probably there are some values that are calculated with PHP in your shortcode and when you change the filter its AJAX, PHP is not run.
What you can try is retook your actions in the JS Filter Hooks we offer to be fired after a set of events (pagination, search, etc) - this can be done in the JS section of your Filter editor in the views.
But that allows you just to re-hook JS code and functions.
Your code probably relies on some displayed data, does not get updated during the AJAX call and hence fails.
You'd need to use Custom Code to hook to our Toolset AJAX JS filter actions which then can rehandle the operations with the new data presented by the View.
However, this'll require Custom Code that we cannot assist here.
Thanks. For the time being I've just switched to not using AJAX. I'll revisit the AJAX options again once I've got more free time.
- Aaron