【问题标题】:How do you get the key of a node that is added to the diagram in GoJS?在 GoJS 中如何获取添加到图表中的节点的键?
【发布时间】:2019-11-21 02:14:09
【问题描述】:

我想在节点从调色板拖放到图表时获取关键信息(类似于组类中的 memberAdded 属性)。我假设它是 ExternalObjectsDropped 事件处理程序,但是当我检查 e.subject.part 时,输出未定义。我错过了什么或做错了吗?

谢谢。

【问题讨论】:

    标签: javascript gojs


    【解决方案1】:
    $(go.Diagram, . . .,
      {
        "ExternalObjectsDropped": function(e) {
          // e.subject is a go.Set of the dropped Parts
          e.subject.each(function(p) {
            if (p instanceof go.Node) console.log(p.key);
          })
        }
      })
    

    更多信息请访问:https://gojs.net/latest/intro/events.html#ExternalObjectsDropped

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-07-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-22
      • 1970-01-01
      相关资源
      最近更新 更多