Skip Navigation

[Resolved] JS event listener for change in a parametric search

This support ticket is created 5 years, 1 month 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Tim Elliott 5 years, 1 month ago.

Assisted by: Shane.

Author
Posts
#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: English (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.