Tree Mapping in GOJS :: Only Parent mapped then allow child mapping

Tree Mapping in GOJS. I like to do if parent is mapped together then I allow children to map in the tree.

+ Parent1---------------------------Parent2
   child1------------------------------Child10
   child2
  +Child3-------------------------------+Child11
     child4--------------------------------Child12

Could you please help on this?

That sounds as if you need to define a linkValidation predicate: GoJS Validation -- Northwoods Software

How to restrict the link to delete from the tree mapping

if (e.change === go.ChangedEvent.Remove && e.propertyName === "linkDataArray") {

return false;
}

I have to restrict the user to delete the link… above code is not working

Override CommandHandler | GoJS API

For example:

$(go.Diagram, ...,
{
  "commandHandler.canDeleteSelection":
    function() {
      if (this.diagram.selection.any(function(p) {
          return p instanceof go.Link && ... ;
        })) return false;
      return go.CommandHandler.prototype.canDeleteSelection.call(this);
    },
  ...
});

We need the From and to points of the try to deleted items

Surely you already know about Link.fromNode and Link.toNode?

2 posts were split to a new topic: Unable to call getDocumentPoint

I have already listed the tree in tree mapping… I need to replace the nodeDataArray with new values it should be in the same tree format. I changed it but its not working…

One doesn’t normally replace the Model.nodeDataArray unless one actually wants to replace the whole Diagram.model. This question does not involve the tree mapping sample, so I think it would be better as a separate topic.