Can't find a way to cancel event

Hii I am using diagram's 'collectionChange' event.
 Will i be able to cancel that event based on some condition?
If yes Please let me know

1 Reply

AR Aravind Ravi Syncfusion Team May 28, 2020 06:29 AM UTC

Hi Sunil, 

We have created a sample to use cancel state at collection change event. When you add/delete any nodes or connectors in the diagram, collectionChange event gets fired. In the collectionChange event if you add any new node event triggers for the type of Addition. In the args type Addition and state of Changing set cancel as true. So that new node does not gets added in the diagram. Similarly when you delete any nodes from the diagram collectionChange event triggers for type Removal. So set cancel as true in the changing state so that node does not gets removed. Please find the below code snippet for how to use collection change event 

collectionChange: (args) => { 
        if(args.state === 'Changing') { 
          if(args.type === 'Addition') { 
          args.cancel = true; 
          } else { 
            args.cancel = true; 
         
       
      }, 


Regards 
Aravind Ravi 


Loader.
Up arrow icon