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

209
Visualizações
Multiple Row Edit Functionality in React

I am trying to implement an edit row functionality in a react grid. I have attached 2 links. Link 1 is the GIF which shows the functionality that I have implemented using the below code.(For privacy reasons I cannot publish the actual code)

Link 2 is the functionality I am trying to achieve! How shall I do that?

 return (
  <>
    <p>Sample Row Field</p>
    {editId === Id && editRow === true ? (
      <select options={options} handleChange={handleChange} />
    ) : (
      existingRowValue
    )}
  </>
);

Link 1 - The Functionality I have (Individual Row)

https://i.stack.imgur.com/JJEL5.gif

Link 2 - The Functionality I want (Multiple Rows)

https://i.stack.imgur.com/w7ppb.gif

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

I'd assume editId is a local state variable, same for editRow So what you'd need to do is change editId into a state called editIds as an array (because you want to edit multiple rows, not just one), and replace editId === Id with editIds.includes(Id)

  • onEditClick: should add the rowId into this state, like setEditIds(...editIds, rowId)
  • onSave/CancelClick: should remove the id from the state, like: setEditIds(editIds.filter((id) => id !== rowId))
about 4 years ago · Juan Pablo Isaza Relatório

0

I think following code sample will give you an idea of how you can achieve this when you move your editId to a local component state.

https://codesandbox.io/embed/hardcore-sid-pythne?fontsize=14&hidenavigation=1&theme=dark

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