Click handlers within list views, how to get an id?

Hi all, I have a list view with a delete button within it. I'm trying to trigger a query and pass an id in via additional scope. How can I do this?

The UI looks like this:

And I'm trying to add a click event to that icon that deletes that specific row. I've tried the following scripts:

DeleteNote.trigger({
  additionalScope: {
    deletedNoteId: item.id
  }
})

and even:

DeleteNote.trigger({
  additionalScope: {
    deletedNoteId: GetNotes.data.id[i], // i've heard `i` can be available within lists
  }
})

neither seem available while i edit nor at runtime. Feedback for retool folks - this seems like a super common case and both these variables should be available in some way honestly.

I assume someone has strategies for making this work since its a pretty common pattern.

Could you tell me more about the structure of your list view? Is it:

  • ListView (new)
    • container
      • button

If so, please try referencing item.id as <yourListVewId>.item.id.

We are currently working on some scoping bugs, one of which you might be running into right now.

1 Like

Ahhh yea, that's the structure (screenshot if helpful)
Screenshot 2023-12-11 at 1.23.31 PM

And it worked - thanks!

2 Likes