0

I'm using go.js and I added a ContextMenu to my diagram. One of the buttons is a "visit" button, which should redirect user to a certain URL. My problem is that those URLs are generated using IDs. I wanted to know if it's possible to set some attributes to a node, and use them in my contextMenu.

I'm using a go.panel for creating my nodes, and some go.TextBlock in them. All the data used to create the nodes are from a JSON array, exactly like in this example

Here is my contextMenu :

$(go.Adornment, "Vertical",
    $("ContextMenuButton",
        $(go.TextBlock, "Visit",
            { click: function(e, obj) { VisitGroup(obj); } }))

);

I dont know how to set attributes to nodes, and how to access any information related to the node. Thanks !

4

1 回答 1

1

是的,设置将信息存储在节点数据中并使用obj.part.data是正确的方法。

之所以有效,是因为Adornment.data将与Adornment.adornedPart.data- 所有装饰都绑定到与装饰部分相同的数据。

于 2014-12-27T04:47:08.570 回答