Open modal on click of DataGrid row

I have a DataGrid.

On click of a specific row, I want a modal to show with information specific to that row.

First, I tried using the select column to initiate an “On click” state, which records the “item.data.id” in a variable called “clickedRow.”

However, the “clickedRow” variable does not record the “item.data.id” when checking the variable in the side panel.
image

I tried the same when clicking on a particular cell, but receive the same results.

I figured it out.

Set the “clickedRow” variable to type object.
On click, partial update the “clickedRow” variable with item.id and set the value also as the item.id.
Then you will have the row id store as a key:value pair and can manipulate accordingly.

1 Like

Nicely done! :raised_hands:

1 Like