Access single row data but in a multiple selection table

Hi! I'm a new retool developer so trying to figuring out a lot of things.
This is the situation:

I have a table with an action button that opens a modal and shows the img urls for the specific item I select. The thing is my table also has multiple selection rows so when I try to click a button from a row it breaks because it can't find the data for that specific row.

This is the query I use to get the urls from the db:
image

This is the table:

This is the modal and the listview with the image:

I am going to assume that getImagesByPlay is the name for the select query you posted above? Not clear on why you would need the index i in the selectedRow.data[i].id query.

Using selectedRow.data.id should pick up the id in that selected row without using the index [i]

Is the listview component is set up correctly?

Hi @mateoMaturano! We actually have a bug where i is not accurately defined when using action buttons. I think that may be the issue you're running into here.

We are working on this bug and hope to have a solution soon. In the meantime, the workaround is to use a custom column (column type button).

In this example, I have several rows selected, but when I click the second button in the table, I'm able to return the data for the second row using table1.data[i]

1 Like

Hi @Tess, That's awesome! I'm gonna try it these days if it works.
Thanks for the alternative solution :smiley:

Hi @Tess I'm trying to do this but when I click on the view button I get no response

I created the custom column with button type but I don't get a response :confused:

Hi @mateoMaturano! Can we see your column settings too?

Sure

Hi @terrywong Thanks for reaching out! Can you share a screenshot of your setup?

The query was triggered when I clicked the button but nothing was returned.


Hmm, can we see jobs_table.data in the left panel expanded out to see the data structure (like the below example):

Hi, has this issue been solved?
I was looking for the same solution, return data from a multiple selec tables where I only need data from one row, the one "selected" via clicking on the specific row and not selected via the check-box.
the return tablename.data[i] runs successfully, but not data shown
Any other suggestion is more than welcome. I do want to show that row in a Modal

Hi @Evert

I think you could also use the selectedCell data instead of i, with or without the checkbox feature, to get the most recently clicked row data.

Let us know if this isn't helpful! Happy to take another look

Hi @Tess It is always returning me first row of the table

const { ipfs } = table_one_data.value.find(t => t.id == table1.data[i].id)

while it should return only the clicked one

Hi @Bilal_Anjum,

We launched a new table since this post first came out, so this may be different now.

Where are you using:
const { ipfs } = table_one_data.value.find(t => t.id == table1.data[i].id)

Is it used on click of View Image? Is it in a Javascript query? You could have a run script event that passes i from the table: