I originally posted this in premium help until jsakalos recommended it be considered a bug and not a question:


Ext version tested:

  • Ext 4.1
Browser versions tested against:

  • Chrome 24

The bug can be viewed even on this demo grid:


The problem summary is trying to call the disable() method of the drag/drop plugin causes a bug in the onBeforeDrag event, and also with event handlers on beforeselect + onBeforeDrag are done in an incorrect call ordering.

Steps to reproduce the problem:

Here is code to run against the demo grid (pull up the console in chrome to paste), to demonstrate the one concern:

var grid = Ext.ComponentQuery.query('grid[title="First Grid"]')[0];grid.getView().plugins[0].dragZone.onBeforeDrag = function() {  console.log('onBeforeDrag', grid.getSelectionModel().getSelection());};
If you click and drag in one action (click the row and drag in without releasing or pausing - I know it might look silly at first but if you're working all day in an app and fluidly dragging rows around it is actually pretty natural to do that). It gets no selection at the time it tries to drag that selection! If you click the row, release the mouse, then drag - it works.

The other issue (and likely the cause of the first issue) is the order of the events. When I add this code and then do another drag in one mouse move you can see that the selection is made after the drag:

var grid = Ext.ComponentQuery.query('grid[title="First Grid"]')[0];
grid.getView().plugins[0].dragZone.onBeforeDrag = function() {  console.log('onBeforeDrag', grid.getSelectionModel().getSelection());};

So the above post shows the quirks in the ordering of events that I think should be considered for a change. The final and buggy result is it getting stuck. This can be shown on the example grid in the samples:

grid.on('beforeselect', function() {grid.getView().plugins[0].disable()});
If you do that with the single-mouse-action it gets stuck in mid air. If you re-enable the plugin, then its all broken: