Results 1 to 3 of 3

Thread: Dragging <A> links from Grid or List to the desktop does not work in Chrome

  1. #1
    Sencha Premium Member
    Join Date
    May 2011

    Question Dragging <A> links from Grid or List to the desktop does not work in Chrome

    Hello fellow developers,

    I'm adding a drag-links-to-desktop feature.
    To do so, I'm taking advantage of native ability of every browser on any platform to handle drag-and-drop of a link ( or image ) to the desktop.

    This is achieved in Grids and Lists by using dedicated renderers that basically put <A href="http://mylink"> around elements.
    This works on every tested browser, except Chrome and Safari ( probably WebKit Related ) where nothing happen, like if the drag was just ignored.

    This is the expected behaviour, with Firefox ( animated gif ) :


    This is the HTML result, to get a better understanding :


    Please note that :
    - no DragSource is set on the grids or lists as it would prevent dragging links to desktop, overriding it with gxt drag feature.
    - no errors are logged
    - i tried to add debug functions for on dragstart on any parent of the <A> and none of them were called.

    Is there a special operation to perform to enable the expected behaviour on Chrome? Is it a bug ? Any idea of a workaround or even better , a solution ?

    Thanks in advance for your answers.

    Note : We're using GWT 2.5.1 and GXT 2.3 (gxt-2.3.0-gwt22.jar).

  2. #2
    Sencha Premium Member
    Join Date
    May 2011


    I asked Sencha Support to give a hand on this topic and got an answer with a working walkaround.

    Here you are :

    it turns out that GXT 2 has specific code to deal with webkit browsers and prevent them from dragging - [...].

    This is the code in question, specifically the e.preventDefault():
    protected void onMouseDown(GridEvent<M> e) {
        if (isDisableTextSelection() && GXT.isWebKit) {
            String tagName = e.getEvent().getEventTarget().<Element> cast().getTagName();
            if (!"input".equalsIgnoreCase(tagName) && !"textarea".equalsIgnoreCase(tagName)) {
        if (e.getRowIndex() != -1) {
            fireEvent(Events.RowMouseDown, e);
            if (e.getColIndex() != -1) {
                fireEvent(Events.CellMouseDown, e); 

    You can override Grid to change this - everything in that method is publicly accessible, just skip the first if block entirely, and only use the second to still fire internal events as expected.

  3. #3
    Sencha User
    Join Date
    Feb 2009


    One other detail from that ticket: This preventDefault call was added several years ago in 2.x, though does not exist in 3.x. This suggests that it may be required to fix a specific issue in older webkit browsers. As 2.x is the older version currently supported, we are very concerned with maintaining existing bugfixes and browser support, so cannot remove this code from the library itself.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts