Skip Navigation

[Résolu] Call Javascript after ajax filter

Ce fil est résolu. Voici une description du problème et la solution proposée.

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 Il y a 6 années et 9 mois. 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.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

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)

Marqué : ,

Ce sujet contient 2 réponses, a 2 voix.

Dernière mise à jour par Adrian Il y a 6 années et 9 mois.

Assisté par: Minesh.

Auteur
Publications
#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

Les langues: Anglais (English )

Fuseau horaire: 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:
=> lien caché

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