Accepted answer

No need to use the click handler of the button. You cannot get row data with that.

Add a colId to column definition for actions. Then handle the onCellClicked action of the grid. You can get the row data using

const [videoName, setVideoName] = useState("");

function onCellClicked(params) {
    // maps to colId: "action" in columnDefs,
    if (params.column.colId === "action") {
      // set videoName for the row

// grid config

// access videoName in dialog content
 {/* <iframe width="420" height="315" title="videos" src={id} /> */}

Edit reverent-zhukovsky-gt4mln

Output - Click on any row's play button. Result is that rows video url. You can now use this to play the actual video.



If I correctly understood the question, it is because in DialogContent you are mapping through all response, and showing all of them. Instead why not here:

const actionButton = (params) => {

instead of storing true, store id (it seems video name could work in your case too) of the row clicked. Then inside DialogContent render only one iframe, with video based on that id.

PS. You can pass !!id as open prop to Dialog, which means if there is something in id, the Dialog will open (assuming there are no ids with falsy values).

Or you can actually store the whole row itself in state, and then you can more easily access it, here is simple example what I mean:

let data = [
  { name: 'david', id: 0 },
  { name: 'nick', id: 1 },
  { name: 'john', id: 2 },

export default function App() {
  let [clicked, setClicked] = React.useState(null);
  return (
      { => {
        return (
            onClick={() => {
            Row {}
      <div>Clicked row {clicked &&}</div>

Related Query

More Query from same tag