Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    reverse action of DragDataAction.NONE

    Hello,

    I'm loving drag and drop and hope to implement it on a lot of places.

    But what is the general approach in implementing a 'remove' of a copied record by drag and drop?

    Case:
    Tree1
    Grid1
    Grid2

    Grid1 & Grid2 accept dropped records from Tree1 with DragDataAction.NONE

    Now I want to remove records from the grids. A simple "drag out and release mouse button and record is out of the grid" is what I need. The grid is already too small to have another column with a delete button, and I don't want to use right-click as in the "Drag create showcase sample".

    To make it even more clear and staying with the above showcase sample: how can I remove the small cubes from their box and delete them, by dragging? Is the only possible approach making everything around the box accept drags and don't do anything with the dragged record?



    I've thought about simply dragging records back to Tree1 to remove them from the grids, but since the dragged-to-grid record stays in Tree1, I think it's confusing for users to have the Tree1 as delete bucket.


    thanks

    #2
    You can implement this by adding canDragRecordsOut:true on the grids, and installing a dragStop handler that removes the currently selected records if there is no valid drop target at the end of the drag.

    Comment


      #3
      Thanks for that suggestion,
      any hint on how to get the drop target?

      A bit confusing was EventHandler.getDragTarget(), which does not return the target, but the source, as in it's doc: "This is the component on which the drag and drop interaction was initiated."

      Comment


        #4
        It's sufficient (and more correct) to check that the current mouse coordinate is not over the originating ListGrid.

        Comment

        Working...
        X