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

151
Vistas
PrimeReact Tree onNodeClick function is not being called

I'm using PrimeReact's Tree component with a drag and drop, single selection, and an onNodeClick event for the node. The drag and drop and selection is working fine but the onNodeClick event is just not firing.


         <Tree
          value={nodes}
          expandedKeys={expandedKeys}
          onToggle={(e) => setExpandedKeys(e.value)}
          dragdropScope="demo"
          onDragDrop={(event) => setNodes(event.value)}
          onContextMenu={(event) => cm.current.show(event.originalEvent)}
          selectionMode="single"
          selectionKeys={selectedKey}
          onSelectionChange={(e) => setSelectedKey(e.value)}
          onNodeClick={(event) => openFile(event)}
        />

However, the event fires when the function is called directly:


         <Tree
          value={nodes}
          expandedKeys={expandedKeys}
          onToggle={(e) => setExpandedKeys(e.value)}
          dragdropScope="demo"
          onDragDrop={(event) => setNodes(event.value)}
          onContextMenu={(event) => cm.current.show(event.originalEvent)}
          selectionMode="single"
          selectionKeys={selectedKey}
          onSelectionChange={(e) => setSelectedKey(e.value)}
          onNodeClick={openFile()}
        />

The problem with the second piece of code is that the event is fired on page load and just keeps firing away.

The first one is probably the correct way to do it as the event contains the node parameters according to documentation but I just can't seem to fire it. What am I doing wrong here?

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