P0ulBogd
P0ulBogd

Reputation: 77

GXT FramedPanel Drag for header

I want include Grid in FramedPanel and using gxt dnd.
But if I add FramedPanel in DragSource:

DragSource source = new DragSource(framedPanel) {
              @Override
              protected void onDragStart(DndDragStartEvent event) {
                super.onDragStart(event);
                event.setData(framedPanel);


              }
            };


DnD works when I click and hold on Grid. How I can do to DnD only worked on the header of FramedPanel.

Upvotes: 0

Views: 180

Answers (1)

Colin Alworth
Colin Alworth

Reputation: 18346

Consider using Draggable instead of DragSource, then use the constructor that takes two arguments. This way you can specify the header as the 'handle' argument.

Draggable draggable = new Draggable(framedPanel, framedPanel.getHeader());
//assuming GXT 3, just guessing from your post
draggable.addDragStartHandler(new DragStartHandler() {
  public void onDragStart(DragStartEvent event) {
    //...
  }
});

If you must use DragSource, subclass it to replace the Draggable instance, and create a new instance as specified above, plus making the changes found in the existing DragSource constructor.

Upvotes: 1

Related Questions