Category: How do I do X?
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

Table select a row and open a Modal, open a different Modal on row 2

Issue

I need to open two different modals based on which row I click in my table. I want to display Modal1 if I click on row 1 and Modal2 if I click on row 2. How can I achieve this?

Resolution

To open two different modals in a table when clicking on different rows, you can use the showModal function in the onClick property of the buttons. First, define your modals with different names. In the code, write an if-else condition that displays different modals based on the data in the columns. For example, if the first row triggers the Modal1 and the second triggers the Modal2, you would write:

{{
function(){
if (Table1.triggeredRow.status=== "Modal1"){
showModal("Modal1")
}
else{
showModal("Modal2")
}
}()
}}

This code will check which row triggered the onClick event and then display the associated modal accordingly. Make sure to replace "Table1" with the name of your table, and "status" with the column name that contains the data to determine which modal to display. You can adjust the condition to fit your specific needs.