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

Creating nodes dynamically

$
0
0

@TheChroniQ wrote:

Hello there,

I am quite new at GoJs, and I am currently running a Palette and a Diagram very similar to Data Flow sample -> https://gojs.net/latest/samples/dataFlow.html.
I managed to create nodes, links and adding those to both my Palette and Diagram.
Now, I come to a point where I want to let the user create a custom node himself, based on his desired layout.

For instance,
Number of columns
Number of rows
Number of inports/outports
Does node include picture?

This is more a javascript implementation type question than GoJs but I am wondering how to construct a Node depending on those layout parameters.

I thought of something like this,

function createWidget(typename, rows, columns, hasPicture, picturePath, w, maxports, background, inports, outports){
    var node = $(go.Node, "Spot",
    $(go.Panel, "Auto",
         for(var i;i<columns;i++) $.(go.TextBlock, "Name :", {row : 1, column: i}

And then once this node is being created, just call

addNodeData(nodedata)

To add it to the diagram/palette.
I am quite stuck at this point...

Posts: 5

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles