Tree - Drag and Drop

UI Components for React
Post Reply
arnon_e
Posts: 1
Joined: 24 Apr 2023, 09:35

30 Aug 2023, 12:34

Hi
I want to use the drag and drop on tree.
I want that during mouse move I will be able to check if it's ok to drop the item or not and if it's not ok to change the cursor to 'none'.
I succeeded to check if it's ok or not to drop the item I drag but I can't change the cursor.

I tried to do the following code but it's not working, the effectAllowed stay as initialize in the onDragStart

Code: Select all

const handleDragOver = (event, node) => {
    if (node.key !== selectedItem.key && lastDragOverKey != node.key) {
      const isValid = isPasteValid(selectedItem, node);
      event.dataTransfer.effectAllowed = isValid ? "copy" : "none"; // Set effectAllowed on the source
      setLastDragOverKey(node.key);
    }
  };
Can anyone know how to do that?

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 16 guests