开发者

Dragging a widget down a long list so that scrolling is necessary with gwt-dnd

I'm investigating using gwt-dnd to implement drag-and-drop reordering of a list of widgets. The list might be longer than its visible area, and so I'd like the user to be able to do that drag-the-widget-near-the-bottom-and开发者_高级运维-the-list-auto-scrolls behavior that's pretty much standard.

Does gwt-dnd have this support built in anywhere? If not, any ideas on implementing it?


You can try to do the following in case, you are using PickUpDragController and other classes which might have dragMove.

Subclass the PickUpDragController class and override dragMove as follows

@Override
  public void dragMove()
  {
        DOM.scrollIntoView(context.selectedWidgets.get(0).getElement());
        super.dragMove();
  }


As it turns out, gwt-dnd has support for this automatically. It requires that the dropArea be inside an AbsolutePanel dragBoundary, and that the dragBoundary is within a scroll panel.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜