dabeng / react-orgchart

It's a simple and direct organization chart plugin. Anytime you want a tree-like chart, you can turn to OrgChart.
MIT License
135 stars 112 forks source link

After adding child node to a selected element drag & drop is not working #8

Open akash-int opened 4 years ago

akash-int commented 4 years ago

Hi @dabeng I'm getting this error - SyntaxError: Failed to execute 'querySelector' on 'Document': '#562bebec-9002-4228-b3da-1a3a589323d1' is not a valid selector.

Can you please look into this. Thanks in advance.

mxt305 commented 4 years ago

Because it uses your data id as HTML element id, the HTML element id attribute can not start with numbers. To avoid this error, I think you can add a letter like "n" in front of your id, for example change id 562bebec-9002-4228-b3da-1a3a589323d1 into n562bebec-9002-4228-b3da-1a3a589323d1. Furthermore if your data id contains any space characters, the error might occur.

akash-int commented 4 years ago

Hi @mxt305 Thanks for your reply. I have modified the logic as per your example & now it's working perfectly.

Thanks a lot :-)

akash-int commented 4 years ago

Hi @dabeng @mxt305 Anyone can please tell me is there any event handler for drag & drop? Because on the drag of node I have to check & restrict the user on some specific node to drop.

confrodog commented 4 years ago

ondrag?

erbaafidotama commented 4 months ago

ondrag?

Cant use onDrag. i have tried onDragStart and onDragEnd too, but cant. How to handle drag n drop?