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

210
Vistas
How to make rowEvents in react-bootstrap-table-next be called on a button only instead of a row

I am working on a react-bootstrap-table, I set it up in a way when I click on the icon button, a modal pops up displaying the information of the row data. But when I click on another column of a row, the modal also pops up displaying data.

I want a situation whereby the modal only pops up when you click on the icon, instead of the row. This is making the cellEdit function not to be called. enter image description here

        const [modalInfo, setModalInfo] = useState([])
        const [show, setShow] = useState(false);
        const [showModal, setShowModal] = useState(null);

         const rowEvents = {onClick: (e, row) => {
         setModalInfo(row);
         toggleTrueFalse();
         },
        };

        const toggleTrueFalse = () => setShowModal(handleShow);

Cell Edit

         const cellEdit = cellEditFactory({
         mode: 'click',
         blurToSave: true,})

Modal

        const ModalContent = () => {
           return (
             <>
            <Modal isOpen show={show}>
           <ModalHeader>Terminal Info</ModalHeader>
          <ModalBody>
           <ul>
          <h6 style={{ fontFamily: 'Georgia' }}>id : {modalInfo.id}</h6>
          </ul>
          </ModalBody>
          <ModalFooter>
         <Button color="secondary" onClick={handleClose}>
          <FontAwesomeIcon icon="ban" />
          &nbsp; Close
         </Button>
         </ModalFooter>
         </Modal>
           </>
        );
      };

jsx

         return (
             <>
            <div>
           <h2 style={{ color: "red", fontFamily: "Georgia" }}>Terminals</h2>
         </div>
         <BootstrapTable
          keyField="id"
          data={data}
          columns={columns}
          cellEdit={cellEdit}
          rowEvents={rowEvents}
           />
           {show ? <ModalContent /> : null}
         </>
        );
  

If I can be able to achieve this, then cellEdit will work fine.

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