Symbol Palette Item Id/Name

I currently have a SymbolPalette with 3 node items. 

When a user drags an item onto the diagram, I use args.cancel = true to cancel the node creation and then kick off another JS function.  I would like to capture some identifier (name preferably) of the dragged item to pass to the 2nd JS function.  Is there a way I can collect an identified for what the user is dragging prior to disposing of it?
function drop(args) {
           
            // need a way to find a dragged item's identifier (name, id, something)
            var identifier = args.Node.Name

            // Cancel Node Placement
            args.cancel = true;

            //call new fuction
            dosomethingelse(identifier);
        }

1 Reply 1 reply marked as answer

AR Aravind Ravi Syncfusion Team August 3, 2020 05:59 AM UTC

Hi Dsoftware, 

We have created a sample to remove the specify node dropped from palette. By using the node AddInfo property we can able to store the node’s additional information. In the node AddInfo property store any specify value to the node. When drag and drop a node from palette to diagram Drop event gets triggered. In that event check if the elementType is Node and check the node AddInfo value. Please refer below code snippet for how to give AddInfo value and how to use Drop event 

BasicShape ellipse = new BasicShape() 
           
                Name = "Ellipse", 
                AddInfo = new string[] {"Ellipse"}, 
                //Specifies node size 
                Width = 50, 
                Height = 50, 
                //Specifies node offset   
                OffsetX = 50, 
                OffsetY = 50, 
                //Specifies node shape 
                Shape = BasicShapes.Ellipse 
            }; 

function Drop(args) { 
         if (args.elementType === "node" && args.element.addInfo[0] === "Ellipse") { 
             args.cancel = true; 
        
       

We have attached a sample for your reference. Please find the sample in below link 


Regards 
Aravind Ravi 


Marked as answer
Loader.
Up arrow icon