Skip Navigation

[Résolu] JS event listener for change in a parametric search

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.

Marqué : 

This topic contains 3 réponses, has 2 voix.

Last updated by Tim Elliott Il y a 1 an et 11 mois.

Assigned support staff: Shane.

Auteur
Publications
#1379023

Tell us what you are trying to do?
I have a masonry grid in a view - the size of the elements are updated using javascript to give the masonry effect. I have event listeners to run this code onload and when the screen is resized.

window.addEventListener ?
window.addEventListener("load",resizeAllGridItems,false) :
window.attachEvent && window.attachEvent("onload",resizeAllGridItems);

window.addEventListener("resize", resizeAllGridItems);

However they don't resize when the page is refreshed by ajax for a change in a search parameter. Is there a way add a listener for the update to parametric search?

On a connected note, the image I have in the loop doesn't display after the ajax refresh either.

Is there any documentation that you are following? No

Is there a similar example that we can see? Not that I know of

What is the link to your site? hidden link but you will need to be logged in to view.

#1379029

Actually you can ignore the second part "On a connected note, the image I have in the loop doesn't display after the ajax refresh either". The image doesn't display if I use a custom size, but if I use a standard size it does.

#1379093

Shane
Supporter

Languages: Anglais (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Tim,

Thank you for contacting our support forum.

Actually given that its an ajax event done with views you will need to add the callback function for the even.

Go to your Filter Editor in your view and then click on the JS tab. From there you should see a button called Frontend Event..

Click this and from there you can add the appropriate callback function that is required for your view.

Thanks,
Shane

#1379269

Thanks Shane, that's done it.