Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

258
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda