Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

Creating a new group on HTML button click

$
0
0

@jerry.exe wrote:

Hi, I am a noob here. I am trying to add a new group without any nodes inside. but so far no success. Kindly guide me to the right direction.
what I actually want to do is that...
I have a HTML button, and "onclick" it will ask user to enter groupName and groupText. and then on user confirmation, it should add an empty group to the diagram.

I have tried doing it like this...but it doesn't change anything

var nodeObj = {key: "newKey", text: $("#inputText").val(), name: $("#inputName").val(), isGroup: true};
myDiagram.startTransaction("newGroup");
myDiagram.model.addNodeData(nodeObj);
myDiagram.commitTransaction("newGroup");

I have also tried to do it like this... but it messes up the links

var nodeObj = {key: "newKey", text: $("#inputText").val(), name: $("#inputName").val(), isGroup: true};
myDiagram.model = new go.GraphLinksModel(nodeObj);

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles