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

Node Clone

Hello.
Can I Deny to copy root element (for example by constrains)
thanks.

3 Replies

SG Shyam G Syncfusion Team December 1, 2015 05:47 PM UTC

Hi Hamid,

Please use command manager to prevent the copy command. please refer to the code example and JSPlayground link below. If we misunderstood your requirement, please provide us more details such as the usecase in which you need to prevent the copy command or more details about your requirement.

Code example:

$("#diagram").ejDiagram({         

            commandManager: {

                commands: {

                    //Command name

                    "copy": {

                        //Command handler

                        canExecute: function copy(args) { return false },

                    }

                }

            },
        });

jsPlayground link:https://jsplayground.syncfusion.com/sarli221

Regards,
Shyam G



HA hamidR December 27, 2015 11:02 AM UTC

Hello.
Thanks for your reply, but my problem not dissolve.
assume mind map diagram that has a ROOT node. i can disable only copy of root node.
thanks


SG Shyam G Syncfusion Team December 28, 2015 10:07 AM UTC

Hi Hamid,

We have created a mind map sample in which we have disabled the copy of root node using the command manager. Please refer to the code example and JSPlayground link.

Code example:

$("#diagram").ejDiagram({

 

                commandManager: {

                    commands: {

                        //Command name

                        "copy": {

                            //Command handler

                            canExecute: copying,

                        }

                    }

                },

 
            });

  function copying(args) {            

            var node = args.model.selectedItems.children[0];

            if (node.branch == "root") {

                return false;

            }

            else

            {

                return true;

            }
        }

JSPlayground link:https://jsplayground.syncfusion.com/n0pk35ee

Regards,
Shyam G


Loader.
Up arrow icon