We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Is it possible to call this.setState() in IDropEventArgs?

Hello.

I tried to call this.setState({}) in IDropEventArgs of drop event.
but the following error appears:

ej2-diagrams.es5.js:27754 Uncaught TypeError: Cannot read property 'children' of undefined
    at DiagramComponent../node_modules/@syncfusion/ej2-diagrams/dist/es6/ej2-diagrams.es5.js.Diagram.removeObjectsFromLayer (VM5207 bundle.js:45987)
    at Droppable.droppable.drop (VM5207 bundle.js:49965)
    at Observer../node_modules/@syncfusion/ej2-base/src/observer.js.Observer.notify (VM5207 bundle.js:9105)
    at Droppable../node_modules/@syncfusion/ej2-base/src/base.js.Base.trigger (VM5207 bundle.js:2697)
    at Droppable../node_modules/@syncfusion/ej2-base/src/droppable.js.Droppable.intDrop (VM5207 bundle.js:5058)
    at Draggable../node_modules/@syncfusion/ej2-base/src/draggable.js.Draggable.intDragStop

Is it impossible to call thi.setState() here?
alternatively, I choose the way to edit node info by call doubleclick event and show modal.but it is better to call this.setState() in IDropEventArgs  and show modal.

IDropEventArgs
https://ej2.syncfusion.com/react/documentation/api/diagram/iDropEventArgs/#position

3 Replies

Ramya Thirugnanam March 4, 2019 07:22 AM UTC

Hi Ryosei,  
 
Thanks for contacting Syncfusion support. 
 
Please use collectionChange event instead of drop event If your requirement is to modify the node after dropped from symbol palette to diagram. The node gets added to diagram with args.state as changed and we can modify the node.  
 
For more information about collectionChange event please refer to below help documentation link 
 
 
Could you please provide us the screenshot or description about your requirement with this.setState method in drop event? This will help us to serve you better. 
 
Regards, 
Ramya T 


RY Ryosei Yawata March 6, 2019 10:38 AM UTC

Hi Ramya T,

Thank you for your answer.
Yes, I also found that I can call this.setState in collectionChange in API document and solved the issue.

Best Regards,

Ryosei

Ramya Thirugnanam March 6, 2019 11:55 AM UTC

Hi Ryosei, 
 
Thanks for your update. 
 
Regards, 
Ramya T 

Loader.
Live Chat Icon For mobile
Up arrow icon