Issue
Hi I am using antd tree for my React application. I am using drag and drop feature of the tree. I have this requirement where I should prevent user from dropping the dragged nodes on certain nodes. Is there any droppable='false'
kind of config available on tree node to prevent the drop on the node?
Solution
allowDrop property should be a function,
its parameter is node and its output is Boolean:({ dropNode, dropPosition }) => boolean
this function execute for each node of your tree and base on output the node will be dropable or not
allowDrop ={(node, dropPosition ) => {
console.log(node, dropPosition );
//add some funtionality
return false; //return true/false base on funtionality
}}
Answered By - Kamran Davar
Answer Checked By - - Mary Flores (ReactFix Volunteer)