@Giosk wrote:
I created a Diagram with node and links and what I'm trying to do is to add and remove button in the contextmenu.
The structure is so simple and I create the menu buttons with this function:makeButton = (btnText, action, visiblePredicate) => { return $( "ContextMenuButton", $(go.TextBlock, btnText), { click: action }, visiblePredicate ? new go.Binding("visible", "", function(o, e) { return o.diagram ? visiblePredicate(o, e) : false }).ofObject() : {} ) }
Code that I found in one of your example
The node data contains those information
let node = { key: dataNode.NodeId, NodeId: dataNode.NodeId, DimensionName: dataNode.DimensionName, Filter: dataNode.Filter, NodeLabel: dataNode.NodeLabel, ok: formatValue(dataNode.Ok, dataNode.OkPercentage), warning: formatValue(dataNode.Warning, dataNode.WarningPercentage), error: formatValue(dataNode.Error, dataNode.ErrorPercentage), }
The visiblePredicate has this form:
(e, obj) => { return obj.part.data.DimensionName === "Root" || !obj.part.data.Filter.contains("A") //or B or C }
I have three different button which work as a three different filter: A, B and C.
If you click on button A you retrieve some new nodes from server, every node has its buttons and what I would like that if you click on button A, the retrieved nodes have only button B and C, and if you click on B the retrieved new nodes have only button C.
How can I reach this solution?
Thanks
Posts: 3
Participants: 2