My table has row-level action buttons. One of them opens a modal containing a form. Traditionally, I had a number of form values pre-populate with 'selectedRow' values.
Now, with multi-select enabled, 'selectedRow' doesn't work, and it appears that the appearance of the modal eliminates the possibility of using 'currentRow' values.
I've tried passing the values to variables on click, but from what I can observe the modal's appearance again clears the currentRow values before anything can be stored.
Am I interpreting this issue correctly? If so, I'm looking to see how members of this community would tackle a similar challenge as efficiently as possible.
Note, I did ask a similar question in the below thread, but the challenge was different and solved by a community member so I wanted to open another discussion as this issue would ostensibly have a different solution.
Upon clicking a row's action button, you want to add that row to selected rows (if not already selected)
Steps:
In your table's inspector, click the 3-dot-menu of the Interaction section
Set "On Action click" to "Add the row to the selection"
Introduce a temporary state called selectedRowForAbcRowAction
In your table's relevant row action add 2nd event "Set variable" that set's the value of selectedRowForAbcRowAction to `{{currentRow}}
In your modal frame use selectedRowForAbcRowAction.value to access data
Watch-out (re. option 2):
When considering this option, you might think that in order to access the row's data, instead of introducing a temporary state we can simply use table1.selectedRow or table1.selectedRows[table1.selectedRows.length-1] but you'll notice that this method fails when you click the row action of a previously selected row.
@Toolshed 's suggestions should work, but if you want to keep your selection, you can set a variable in the action handler and then display the modal, like this:
You can see the first even handler on the action sets variable2 and then toggles modalFrame1 to show. Within the modal, I can now access all the data from the row that was clicked by referencing variable2.value
You can use currentRow or currentSourceRow depending on your needs, they are both available in the setValue action.