Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

253
Vistas
Redirect page on row click | Passing argument to onRowClicked event | ag-grid

I can't figure out how to redirect page to certain URL based on which row in ag-grid table user have clicked. All I need is value from one of the cells within a row. I came up with two approaches:

First is to make all rows a class, and then add a click listener to it but to me it feels kinda ugly and not performant when there will be huge amount of rows.

Second approach is about making an event, but in this case I don't know how to pass any kind of information from which row it was called. It can be even value of one of the cells.

var gridOptions = {
    onRowClicked: event => console.log("Row clicked")
};

And i want something like:

var gridOptions = {
    onRowClicked: event => myFunction(someCell.data)
};

If first solution is not a bad practice, please let me know!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Pass the event parameter to your function which should contain the data from the row that was clicked.

const gridOptions ={
    rowData: [
        {make: "Toyota", model: "Celica", price: 35000},
        {make: "Ford", model: "Mondeo", price: 32000},
        {make: "Porsche", model: "Boxter", price: 72000}
    ],
    onRowClicked: event => myFunction(event)
   } 

   const myFunction = (event) => {
       console.log('rowData:')
       console.log(event.data)
   }

Demo

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda