Feature Change Request: Diagram node children
Bug maybe? If we instantiate the diagram node children but don't add any children, then the node doesn't appear and throws a Chrome bug. Would it be better to change the children to a List<string>? Then we could just do a server.childern.add(childId) and foreach.
Example:
var myParentNode = new DiagramNode {...}
myParentNode.Children = new string[Apps.Count];
Uncaught (in promise) TypeError: Cannot read property 'id' of undefined
at r.insertBlazorDiagramObjects (diagrams-d6d441.min.js:1)
at r.insertBlazorDiagramObjects (diagrams-d6d441.min.js:1)
at r.drag (diagrams-d6d441.min.js:1)
at r.updateGroupOffset (diagrams-d6d441.min.js:1)
at r.initObject (diagrams-d6d441.min.js:1)
at r.initNodes (diagrams-d6d441.min.js:1)
at r.initLayerObjects (diagrams-d6d441.min.js:1)
at r.initObjects (diagrams-d6d441.min.js:1)
at r.render (diagrams-d6d441.min.js:1)
at r.appendTo (syncfusion-blazor.min.js:1)
SIGN IN To post a reply.
3 Replies
AR
Aravind Ravi
Syncfusion Team
May 20, 2020 03:58 AM UTC
Hi Scott,
By default, In the group node we only able to set node id’s as children to the group node. We suspect that issue occurs due to you set any number value or any node which is not added in diagram as children to the group node. So that the reported issue occurs. So please add only string as children to the group node. In case if the issue still persists, please share us more details about issue which would help us to proceed further.
Regards
Aravind Ravi
SP
Scott Peal
May 21, 2020 11:12 AM UTC
My issue was I added the wrong ID's to the parent. When I corrected, the issue was fixed. I would prefer List<Diagram> for children so we could use foreach loops from a database call to add node and would eliminate an issue like misspelling the Id.
AR
Aravind Ravi
Syncfusion Team
May 22, 2020 07:37 AM UTC
Hi Scott,
We does not have any immediate plans to change the string array to List<children>. However, by using diagram GetNode we can find whether the node is added in the diagram or not. If the node is present in the diagram node collection means then get node method returns that node else it returns null. So before add children to the node check it by using GetNode method. Please find the below code snippet for how to use the GetNode method.
|
List<string> childnodes = new List<string>();
foreach(string childNode in child)
{
var node = diagram.GetNode(childNode);
if(node != null)
{
childnodes.Add(childNode);
}
}
string[] children = childnodes.ToArray(); |
Regards
Aravind Ravi
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
SP Scott Peal
- May 18, 2020 01:27 PM UTC
- May 22, 2020 07:37 AM UTC