在Draw2d自定义布局/图中拖放子节点

时间:2019-05-28 13:55:07

标签: javascript jquery drag-and-drop draw2d draw2d-js

我有一个Draw2d(js)自定义图形(表),其中包含嵌套的自定义图形(列)。我想将列从一个表拖放到另一个表。我只想从你们那里获得一些有关如何启用grag&drop的准则,我将处理其他逻辑。我看过new draw2d.layout.locator.DraggableLocator()的东西,但这对我不起作用。

const Table = draw2d.shape.layout.VerticalLayout.extend({
  NAME: "Table",
  init: function(attr, setter, getter) {
    this._super(attr
      setter,
      getter
    );

    this.header = new draw2d.shape.layout.HorizontalLayout();

    this.tableNameLabel = new draw2d.shape.basic.Label({ text: attr.name || "Table" });
    this.header.add(this.tableNameLabel);
    this.add(this.header, { row: 0, col: 0 });
    this.columns = attr.columns;
    (attr.columns || []).map((obj, j) => {
      this.add(
        new Column({
          name: obj.name,
          dataType: obj.dataType
        }),
        new draw2d.layout.locator.DraggableLocator() // <---------------------------- Adding locator here
      );
    });
  },
  setName: function(name) {
    this.tableNameLabel.setText(name);

    return this;
  }
});

预先感谢:)

0 个答案:

没有答案