当在 GXT 中拖动时,来自 dragsource 的值被删除

Value from the dragsource is removed when it is dragged in GXT

我可以在 GXT 中将项目从 dragsource 拖放到 droptarget。当我将一个项目从源拖到目标时,它会从源中删除。你能帮我保持源和目标的价值吗?

  DragSource source = new DragSource(html) {
    @Override
    protected void onDragStart(DndDragStartEvent event) {
      super.onDragStart(event);
      event.setData(html);
      event.getStatusProxy().update(builder.toSafeHtml());
    }
  };

DropTarget target = new DropTarget(dropContainer) {
    @Override
    protected void onDragDrop(DndDropEvent event) {
      super.onDragDrop(event);
      HTML html = (HTML) event.getData();
      dropContainer.add(html);
    }
  };

您可以将目标的操作类型设置为MOVE或COPY或任何需要的。

dropTarget.setOperation(Operation.COPY); // This will copy the value from source to target.