New Table with Multiselect - how tell which row was clicked using Actions button

The new actions buttons seem to not work with Multiselect enabled on the new Table component.

I have an Action setup on the table. But I can't figure out how to determine which row the Action button was clicked on. selectedRow is null, i is always 0.

1 Like

@bradlymathews agree it's not the most ergonomic! However, row actions do expose currentRow (clicked row including custom columns and mapped values) and currentSourceRow (unformatted row from the data source) in the event handler properties:

I wish there were an easier way to get these parameters into queries, but for now you can use the additionalScope option or set them to a temporary state which the query then reads from. Hopefully we'll have a better solution soon...

1 Like

Ahh, currentRow gets me what I need. Thanks!

Unfortunately I am not able to use currentRow nor currentSourceRow in actions other than click action.

CleanShot 2023-05-10 at 21.34.35

Hey Vincent! There's a bug filed for this that we should hopefully address soon. In the meantime, would using table1.selectedRow.customerId work for you?

1 Like

Yes using selectedRow works :+1:

I do find it a little counter-intuitive that clicking an action automatically selects the row underneath.
For instance, if you have a detail view or a modal that is opened when a row gets selected, you can't use actions on other rows without automatically selecting them and potentially losing work you're doing in the modal or detail view.

I can't remember for sure but I think the behaviour was different in prior implementations of the Retool table?

1 Like

That's definitely a valid concern. Are you able to replicate the different behavior by any chance?

I'm testing on a legacy Table and it seems to be behaving similarly (clicking a row also changes the selectedRow)!

Screen Recording 2023-05-12 at 2.41.56 PM.mov

I must have misremembered :slight_smile: Thank you for double checking!

Of course!! :blush:

Did the options get reduced for the Actions? I only see Run a query, Open another Retool page, Open a web page, and Copy to clipboard. Since these are the only options, I can't use currentRow in my query.

Hey @ttsunrun! Are you able to use another column type (e.g. Icon) with a Click event handler to access the other action types? You should be able to access currentSourceRow in those actions!

1 Like

Hi @victoria. I'm not really able to use another column type because all the data is generated. I could remap it but that's kind of a pain. If that's the only way I will try to figure it out, it's just weird, because I swear this was working differently like two months ago.

Definitely valid! We went ahead and fixed this behavior so that currentRow (legacy table) and currentSourceRow (new table) should both be defined in the table actions. This should go live with our next Cloud deploy (likely sometime early next week). Let me know how things work for y'all next week :crossed_fingers:

@victoria is the fix you have mentioned going to fix the access to currentSourceRow in query and hash params? I only have it in Only run when field for 'Go to app' action. Do you have an ETA for this?

image
image

I realized that it seems to not be defined but when I click the action it actually works

Oh that's great news! Glad it's functional and I'll look into why the linting isn't working as expected.

1 Like