Can't trigger a modal popup from HTML code

Hello folks, first post in retool community. I've been looking for an answer and I couldn't find one, but maybe it's because I started using Retool this week and my web developing knowledge is pretty limited

1) My goal:
Open a modal frame / call custom functions by clicking icons on a table. In this very case, I want to open a popup to see the details of a patient.

2) Issue:
I get the next error when editing the HTML value:

TypeError: ShowModalGestionPacientes.trigger is not a function,TypeError: ShowModalGestionPacientes.trigger is not a function,TypeError: ShowModalGestionPacientes.trigger is not a function

When this error is present, the eye icon does not appear in the table

3) Steps I've taken to troubleshoot:
The code inside the HTML element is the next one:

  <a 
    style="cursor: pointer; text-decoration: none;"
    title="Detalles"
    onclick="{{ ShowModalGestionPacientes.trigger()}}"
  >
    👁‍🗨
  </a>

I created the next JavaScript query, with the name ShowModalGestionPacientes:

function openModal() {
    modalFrame1.show();
}

return openModal();

4) Additional info:
ShowModalGestionPacientes.trigger() works fine if I place it inside a button.
I've also tried calling the popup directly using modalFrame1.show() and I got a similar error saying the method does not exist

Thanks a lot

Hi there, and welcome to the community!

It might be worth taking a step back and see what the Table component can do here before you need to write/view any underlying HTML code. It appears you might be trying to call a "trigger()" function on a modal, which isn't something that has a trigger() function :thinking:

The table has a "row actions" property which can display a clickable icon/button and the click event action of this button can be used to display a modal window (or perform any other action too).

I've attached a screenshot as an example, is this what you're looking to achieve?

1 Like

Thank you for welcoming me @dcartlidge!

That is exactly what I was looking for! Thanks a lot :slightly_smiling_face:

Didn't know about the row actions nor about the Control component, I thought I needed to access via script