i am using Angular 14 Version
I am Working on PrimeNg DragDrop
control, here I am facing some problems, when I drag the node from the left tree and drop it to the right tree that time dragged node is removing from the left tree.
How do we prevent or retain the node even I am after doing DragDrop between the trees? Trying to drag our own items like
https://primefaces.org/primeng/tree/dragdrop
How can I do this? Help me.
do you mean this? https://www.primefaces.org/primeng/dragdrop, im not sure if i understand what you ask.
If you want items to keep their position after you refresh the page you will need some DB to remember their status,
however if you want dragged item to stay in the left tree after dragging you will need to change source code a little bit
drop(event) {
if (this.draggedProduct) {
let draggedProductIndex = this.findIndex(this.draggedProduct);
this.selectedProducts = [...this.selectedProducts, this.draggedProduct];
// this.availableProducts = this.availableProducts.filter((val,i) => i!=draggedProductIndex);
this.draggedProduct = null;
}
}
try to comment the filter line to prevent item to be deleted from left tree