-
13 Feb 2013 5:38 PM #1
[4.1] grid row drag event occurs before beforeselect fires
[4.1] grid row drag event occurs before beforeselect fires
I originally posted this in premium help until jsakalos recommended it be considered a bug and not a question:
http://www.sencha.com/forum/showthre...450#post938450
Ext version tested:
- Ext 4.1
- Chrome 24
The bug can be viewed even on this demo grid:
http://docs.sencha.com/ext-js/4-1/ex...d_to_grid.html
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:
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.Code:var grid = Ext.ComponentQuery.query('grid[title="First Grid"]')[0];grid.getView().plugins[0].dragZone.onBeforeDrag = function() { console.log('onBeforeDrag', grid.getSelectionModel().getSelection());};
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:
Code: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:
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:Code:grid.on('beforeselect', function() {grid.getView().plugins[0].disable()});
Code:grid.getView().plugins[0].enable()
Thank you for reporting this bug. We will make it our priority to review this report.



Reply With Quote