Run an API request when expanding rows in table

Hello,

I have a table with expandable rows. When I expand a row, I would like to use data from the expanded row to make an API request and then display the data within the expanded row.

Although I can do this by using <parent table>.selectedRow.id, the problem is, when I expand another row, all expanded rows load the data from the one current selected row.

Is there something like a parentRow? Or a way to stop selecting another row from updating other expanded rows?

Thanks

The issue is happening because `selectedRow` stores the currently selected row and not the row that is expanded. To select the current expanded row, use {{currentRow.id}} instead of {{<parent table>.selectedRow.id}}. This will ensure that any expanded rows will show the results of your API request specific to each expanded row!

1 Like