Cannot read properties of undefined (reading 'visible') in Diagram component

Hi Syncfusion

I'm using diagram component + Tree View with enabled drag&drop.
I'm dragging elements from Treeview into diagram with using nodeDragStop event.
The handler is:

    existingTableDropped(args: DragAndDropEventArgs) {
        let targetEle: any = closest(args.target, ".e-droppable");
        targetEle = targetEle ? targetEle : args.target;
        // check an target as diagram
        if (targetEle.classList.contains("e-diagram")) {
            let data: any = args.draggedNodeData;
            let node = {} as NodeModel;
            let id =
                data.parentID == EntityType.Table
                    ? `DbTable${data.text}`
                    : data.parentID == EntityType.Dbview
                    ? `DbView${data.text}`
                    : "";

            let cssClass =
                data.parentID == EntityType.Table
                    ? "table-node"
                    : "dbview-node";
            node.id = id;
            node.shape = {
                type: "HTML",
                content: getNodeTemplate(cssClass, data.text),
            };
            node.height = 30;
            node.width = 230;
            node.offsetX = args.event.offsetX;
            node.offsetY = args.event.offsetY;
            let annotation: ShapeAnnotationModel[] = getAnnotationModel(
                data.text
            );
            node.annotations = annotation;
            //add an node at runtime
            this.diagramInstance.add(node);
            // Remove the treeview node after add the node in diagram
            args.clonedNode.remove();
        }
    }



Then on drag I get an error and I can't see treeview element under cursor during drag, but node is correctly created.


1 Reply

SJ Sivaranjith Jeyabalan Syncfusion Team August 30, 2022 03:26 PM UTC

Hi Alex,

We have created a sample in which we can drag a treeview element into a diagram. Please refer to the sample below. Please upgrade to the latest version (v20.2.45) packages of the diagram to resolve the reported issue.


Regards,

Sivaranjith


Attachment: myproject_60123508.zip

Loader.
Up arrow icon