user2207
user2207

Reputation: 184

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

I am able to drag and drop an item from dragsource to droptarget in GXT. When I drag an item from source to target, it is removed from the source. Can you please help me to keep the value in source and target.

  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);
    }
  };

Upvotes: 1

Views: 74

Answers (1)

Kutty
Kutty

Reputation: 722

You can set the operation type of the target as MOVE or COPY or whatever is required.

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

Upvotes: 2

Related Questions