Skip Navigation

[Resolved] Call Javascript after ajax filter

This thread is resolved. Here is a description of the problem and solution.

Problem:
How to add AJAX callback event after view's ajax filter

Solution:
View's offers AJAX filter callback events which you may use as callback to call your required custom JS.

You can find proposed solution, in this case, with the following reply:
=> https://toolset.com/forums/topic/call-javascript-after-ajax-filter/#post-616222

Relevant Documentation:

This support ticket is created 6 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by Adrian 6 years, 10 months ago.

Assisted by: Minesh.

Author
Posts
#616095

Hi,

I have a list that I am filtering using Ajax.
I also have a javascript that sorts the list based on the various columns.

I call the script on.document.ready, but every time I use the filter, it breaks this as the script is not called again. How can I call this script every time a filter value is changed and the ajax refresh finishes?

Thank you

A.

#616222

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

When you visit view's Filter section's JS box - you will see a button "Frontend Events". When you click it it will allow you to choose ajax callback events for parametric search.

Please check following image:
=> hidden link

For example:

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
    */
        
YOUR CUSTOM CODE GOES HERE
       
});
#616451

Awesome! Exactly what I was looking for