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

104
Vistas
Unable to set a container div with a tree element as a drag image in drag operation

I have a tree structure in UI in angularjs, and I am trying to drag a subtree from one parent node to another parent node. During this operation I need drag image to be of the entire subtree being dragged, however since the drag is actually on the node, it just shows the image of the node and not entire subtree. To solve this I tried to set the drag image as the container div which contains the entire subtree. However with this, it just sets the last element as drag image.

$scope.dragTreeNode = function(event,dragNode) {  
    let element = event.target.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement;
                
    var dummyElement = document.createElement('DIV');
    dummyElement.id = 'draggedElement';
    let cloned = element.cloneNode(true);
    dummyElement.appendChild(cloned);
    document.body.appendChild(dummyElement);
    cloned.classList.add('ghosted');
    console.log(cloned);
    event.dataTransfer.setDragImage(dummyElement, 0, 0);

}

starting drag for this node

Drag image set to last element of tree

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