disabled option still allows an element to move
I see with disabled option the element is not draggable anymore but still moves when I drag another element over it. How can I make it "fixed" position and not let it change the order.
In my case, I need to set the first item fixed, so it should not be draggable and unsortable.
I tried to cancel the sort action by passing condition on onSortMove and return but did not work either. I need to a function like shouldCancelEnd
After a few hours investigation, I managed to add a function like below,
onSortEnd={({newIndex}) => {
if (newIndex === 0) { // the first element is "unsortable"
return;
}
}
}
But ideally I don't want the element move even though it goes back to the original position after mouse unholding
I tried to cancel the sort action by passing condition on
onSortMoveandreturnbut did not work either. I need to a function likeshouldCancelEndAfter a few hours investigation, I managed to add a function like below,
onSortEnd={({newIndex}) => { if (newIndex === 0) { // the first element is "unsortable" return; } } }But ideally I don't want the element move even though it goes back to the original position after mouse unholding
I had a same issue, when first element should be "unsortable". In this case my workaround was
<SortableItem collection={index === 0 ? 1 : 0}/>
This only applies if "unsortable" item is a first item.
I tried to cancel the sort action by passing condition on
onSortMoveandreturnbut did not work either. I need to a function likeshouldCancelEndAfter a few hours investigation, I managed to add a function like below,onSortEnd={({newIndex}) => { if (newIndex === 0) { // the first element is "unsortable" return; } } }But ideally I don't want the element move even though it goes back to the original position after mouse unholding
I had a same issue, when first element should be "unsortable". In this case my workaround was
<SortableItem collection={index === 0 ? 1 : 0}/>This only applies if "unsortable" item is a first item.
<SortableItem collection={index === 0 ? 1 : 0}/>
This will work for both starting and ending elements just need to pass collection={1}.