From 7ca419acdc4bbb71589cbabc6ba134ea92377a33 Mon Sep 17 00:00:00 2001 From: Romain Fliedel Date: Fri, 26 Jul 2013 19:01:58 +0200 Subject: [PATCH 1/3] fix drag selector for extjs 4.2.1 --- ux/grid/plugin/DragSelector.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ux/grid/plugin/DragSelector.js b/ux/grid/plugin/DragSelector.js index 7b88eea..57a6b7e 100644 --- a/ux/grid/plugin/DragSelector.js +++ b/ux/grid/plugin/DragSelector.js @@ -89,22 +89,22 @@ Ext.define('Ext.ux.grid.plugin.DragSelector', { me.mainRegion = me.scroller.getRegion(); me.bodyRegion = me.scroller.getRegion(); - - me.view.all.each(function(el) - { + + for (var i in this.view.all.elements) { objectsSelected.push(me.selModel.isSelected(objectsSelected.length)); - }, me); - + } + me.syncScroll(); }, fillRegions: function() { var rs = this.rs = []; - this.view.all.each(function(el) + for (var i in this.view.all.elements) { - rs.push(el.getRegion()); - }); + var el = this.view.all.elements[i]; + rs.push(Ext.fly(el).getRegion()); + } }, cancelClick: function(e) From 3fc20f4127c4e2987684726284c783614c78bd89 Mon Sep 17 00:00:00 2001 From: Romain Fliedel Date: Fri, 26 Jul 2013 19:03:02 +0200 Subject: [PATCH 2/3] fix invalid selection when view has scroller dragRegion is contrained to bodyRegion, so we need to ignore regions outside of bodyRegion, otherwise we'll be unselecting row when getting out of the body region. --- ux/grid/plugin/DragSelector.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ux/grid/plugin/DragSelector.js b/ux/grid/plugin/DragSelector.js index 57a6b7e..64dd468 100644 --- a/ux/grid/plugin/DragSelector.js +++ b/ux/grid/plugin/DragSelector.js @@ -233,7 +233,10 @@ Ext.define('Ext.ux.grid.plugin.DragSelector', { sel = dragRegion.intersect(r), selected = selModel.isSelected(i), selectedBefore = me.objectsSelected[i]; - + + if (!bodyRegion.intersect(r)) + continue; + if(me.ctrlState) { if(selectedBefore) From cb3d8b4d286773061e7a66ae0e52e013adb478bc Mon Sep 17 00:00:00 2001 From: Romain Fliedel Date: Fri, 26 Jul 2013 19:28:37 +0200 Subject: [PATCH 3/3] prevent selection when sliding the horizontal scrollbar. --- ux/grid/plugin/DragSelector.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ux/grid/plugin/DragSelector.js b/ux/grid/plugin/DragSelector.js index 64dd468..378732f 100644 --- a/ux/grid/plugin/DragSelector.js +++ b/ux/grid/plugin/DragSelector.js @@ -140,6 +140,11 @@ Ext.define('Ext.ux.grid.plugin.DragSelector', { return false; } + if(e.getPageY() > this.view.el.getY() + this.view.el.dom.clientHeight - 20) + { + return false; + } + // call cancelClick this.cancelClick(e); return !this.dragSafe || e.target == this.view.el.dom || Ext.DomQuery.is(e.target, this.targetDragSelector);