Saltar navegación

[Cerrado] Help including views content in modal popup

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 13:00 – 18:00 13:00 – 18:00 -

Zona horaria del colaborador: America/Sao_Paulo (GMT-03:00)

Este tema contiene 1 respuesta, tiene 2 mensajes.

Última actualización por Mateus Getulio 1 year, 11 months ago.

Asistido por: Mateus Getulio.

Autor
Mensajes
#2704325
ViewScreenshot.png

Tell us what you are trying to do?
Including views content in modal popup.

Is there any documentation that you are following?
No 🙂

Is there a similar example that we can see?
Nope 🙂

What is the link to your site?
The view I'm building can be found here: enlace oculto

The first popup link works. But the remaining do not.

Is this possible to fix? Or is it a limitation of Views?

#2704716

Mateus Getulio
Colaborador

Idiomas: Inglés (English )

Zona horaria: America/Sao_Paulo (GMT-03:00)

Hello there,

I inspected it and while the content of each item is being properly placed within the modal content div, clicking on any item except the first one will throw the following error:

agenda-test/:1613 Uncaught TypeError: Cannot read properties of null (reading 'classList')
    at handleShowModal (agenda-test/:1613:61)
    at HTMLAnchorElement.handleOpenModal (agenda-test/:1626:29)
handleShowModal @ agenda-test/:1613

This error normally happens when you're manipulating a DOM element that is not ready or doesn't exist yet.

I believe the issue might be connected to the way document.querySelector works, it will target the first element available that matches the criteria. Based on your screenshot, it looks like you're adding a listener for the click targeting the class name that is the same for all elements. Maybe trying to change your code to have unique listeners could fix this issue.

For example, if I click on any of the links(except the first one) and inspect the empty modal that shows up, I can see that it is trying to read the model content of the first post.

Can you also take a look at this example here: https://toolset.com/forums/topic/view-loop-modal-not-loading-when-given-unique-id/#post-1500843

It has been coded differently, perhaps it will give you some ideas to change your code.

Mateus

El debate ‘[Cerrado] Help including views content in modal popup’ está cerrado y no admite más respuestas.