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

123
Vistas
I am using onChange Event but when I am cancelling the changes its not coming back to the original state. Rather its changing the redux state

I used on onChange event to take input values and display on the screen. But While doing so I encountered a problem that when I am cancelling the changes its not getting cancelled instead it stores the onChange values. I want to keep the original values when cancelling the event.

onChange event

row.edit_mode 
   ?<input type="text" placeholder="Enter data" value={value} onChange={(event) => 
     onTableValueChanged(event, tableIndex, rowIndex, valueIndex)} className="form-control" />
   :<span className="truncate table-truncate ext-data-pr-tooltip" data-pr-tooltip="value">{value} 
     </span>

Fetch details from redix store

const extraction_data = useSelector(state => state.attachment.extraction.output_json);

state used

const [tableEntities, setTableEntities] = React.useState(extraction_data[currentPage - 1].table);

on Cancel event

const cancelTableRow = (row, tableIndex, rowIndex) => {
    let table_entities_cp = [...tableEntities];
    console.log(table_entities_cp);
    let table_entity_cp = table_entities_cp[tableIndex];
    table_entity_cp.rows[rowIndex].edit_mode = false;
    table_entities_cp[tableIndex] = table_entity_cp;
    setTableEntities(table_entities_cp);
  }

onChange Method

const onTableValueChanged = (event, tableIndex, rowIndex, valueIndex) => {
      const updatedTableEntities = [...tableEntities];
      updatedTableEntities[tableIndex].rows[rowIndex].data[valueIndex] = event.target.value;
      setTableEntities(updatedTableEntities);
  }
about 4 years ago · Juan Pablo Isaza
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