Results 1 to 2 of 2

Thread: Odd selection when dragging in ItemSelector and MultiSelect

    Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1

    Default Odd selection when dragging in ItemSelector and MultiSelect

    In DD-enabled widgets that use Ext.view.DragZone, dragging an item that wasn't already selected has odd behavior. Say I'm using an ItemSelector with items {A, B, C} on the left and {X, Y, Z} on the right. I single-click B to select it. Then, without holding CTRL or SHIFT, I drag C to the right pane. What happens is that B comes too.

    My UX designer and I agree that this is unexpected UX, because I am not holding CTRL or SHIFT as if to retain the existing selection. As it is, drag and drop is always a two-click operation: one to clear the current selection, and a second to initiate the drag. When I start dragging an unselected item, I should only get that item, not other selected items. This is how I have always seen drag and drop behave, including Windows and Gnome file explorers. Compare that to when I start dragging one of the selected items: then I should get all selected items.

    The only demo of ItemSelector I could find actually behaves how I would expect: However, the behavior and code has since changed.

    My current workaround is to override Ext.view.DragZone:

    Ext.define('my.overridden.DragZone', {
        override: 'Ext.view.DragZone',
        onInitDrag: function(x, y) {
            var me = this,
                data = me.dragData,
                view = data.view,
                selectionModel = view.getSelectionModel(),
                record = view.getRecord(data.item);
            // Update the selection to match what would have been selected if the user had
            // done a full click on the target node rather than starting a drag from it
            if (!selectionModel.isSelected(record)) {
                // CHANGE: adding the dragged record to the selection is really wonky
                // compared to simply setting the dragged record as the new selection
    //  , true);
      , false);
                // END CHANGE
            data.records = selectionModel.getSelection();
            me.onStartDrag(x, y);
            return true;

    However, it's not ideal as it doesn't respect shift or control being held as Windows Explorer or most other drag-and-drop components do.
    Last edited by Gary Schlosberg; 26 Nov 2013 at 11:01 AM. Reason: add test fiddle

  2. #2
    Sencha User
    Join Date
    Feb 2013


    Thanks for the report! I have opened a bug in our bug tracker.

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