Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic LinkDeletingScript is not getting executed (Read 1543 times)
Kiran B
Full Member
***
Offline


I Love MindFusion!

Posts: 102
Joined: Apr 19th, 2013
LinkDeletingScript is not getting executed
Apr 24th, 2013 at 9:40am
Print Post  
Hi,

When i problematically remove links from the diagram using the below method LinkDeletingScript is not getting executed. I need this event to cancel the delete in some scenarios. How can i achieve this?

function removeSelection() {

        var diagram = $find("diagramView1");
        var selectedItems = diagram.getSelection(); //returns both nodes and links

        if (selectedItems) {
            for (var i = selectedItems.items.length - 1; i >= 0; i--) {
                if (selectedItems.items[i]) {
                    diagram.removeItem(selectedItems.items[i]);
                }
            }
        }
    }

Thanks
Kiran B
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: LinkDeletingScript is not getting executed
Reply #1 - Apr 24th, 2013 at 11:04am
Print Post  
Hi,

LinkDeleting is a validation event raised only when user presses Del for selected links to let you cancel the operation. If calling removeItem yourself, items are deleted unconditionally. To filter out some of them, add your condition to the if statement you already have.

If you are trying to delete nodes but keep their links, you will have to first change the link's Origin or Destination, e.g. set it to diagram.getDummyNode() result to make it an unconnected link.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint