i’m try to set a context menu to exclude a node like this
$$(“ContextMenuButton”,
$$(go.TextBlock, “exclude”),
{ click: function(e, obj) {
<span =“apple-tab-span”="" style=“white-space:pre”> myDiagram.startTransaction(“exclude a node”);
<span =“apple-tab-span”="" style=“white-space:pre”> obj.part.containingGroup=null;
<span =“apple-tab-span”="" style=“white-space:pre”> myDiagram.commitTransaction(“exclude a node”);
<span =“apple-tab-span”="" style=“white-space:pre”> } })
and i have the error like this:
Uncaught Error: The property [object Object] is read-only and cannot be set to null
WARNING: In ToolManager.doMouseDown: UndoManager.transactionLevel is not zeroi don’t understand why the obj.part.containingGroup is read-only and the warning too, can you explain more about this?
One more thing, i want the context menu only show the “exclude” whenever i rightclick on a node that is already contained in a group. How can i do that too?
thanks