Skip to content
Browse files

fixing issue with column drag and drop in IE

Columns native HTML5 Drag and Drop doesn't work in IE.
#187
  • Loading branch information...
1 parent 3f65ee3 commit edf3776e2af46e7395aeb3c512b02d13bcb4551a @igoryan-k igoryan-k committed
Showing with 22 additions and 7 deletions.
  1. +8 −3 build/KoGrid.debug.js
  2. +8 −3 koGrid-2.1.1.debug.js
  3. +1 −1 koGrid-2.1.1.js
  4. +5 −0 src/classes/eventProvider.js
View
11 build/KoGrid.debug.js
@@ -2,7 +2,7 @@
* koGrid JavaScript Library
* Authors: https://github.com/ericmbarnard/koGrid/blob/master/README.md
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
-* Compiled At: 12/19/2012 10:15:47
+* Compiled At: 01/11/2013 15:58:36
***********************************************/
(function (window) {
@@ -659,6 +659,11 @@ window.kg.EventProvider = function (grid) {
self.setDraggables = function(){
if(!grid.config.jqueryUIDraggable){
grid.$root.find('.kgHeaderSortColumn').attr('draggable', 'true');
+ if (navigator.userAgent.indexOf("MSIE") != -1)
+ {
+ //call native IE dragDrop() to start dragging
+ grid.$root.find('.kgHeaderSortColumn').bind('selectstart', function () { this.dragDrop(); return false; });
+ }
} else {
grid.$root.find('.kgHeaderSortColumn').draggable({
helper: 'clone',
@@ -1891,7 +1896,7 @@ window.kg.StyleProvider = function (grid) {
};
/***********************************************
-* FILE: ..\src\classes\SortService.js
+* FILE: ..\src\classes\sortService.js
***********************************************/
window.kg.sortService = {
colSortFnCache: {}, // cache of sorting functions. Once we create them, we don't want to keep re-doing it
@@ -2144,7 +2149,7 @@ window.kg.sortService = {
};
/***********************************************
-* FILE: ..\src\classes\DomUtilityService.js
+* FILE: ..\src\classes\domUtilityService.js
***********************************************/
var getWidths = function () {
var $testContainer = $('<div></div>');
View
11 koGrid-2.1.1.debug.js
@@ -2,7 +2,7 @@
* koGrid JavaScript Library
* Authors: https://github.com/ericmbarnard/koGrid/blob/master/README.md
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
-* Compiled At: 12/19/2012 10:15:47
+* Compiled At: 01/11/2013 15:58:36
***********************************************/
(function (window) {
@@ -659,6 +659,11 @@ window.kg.EventProvider = function (grid) {
self.setDraggables = function(){
if(!grid.config.jqueryUIDraggable){
grid.$root.find('.kgHeaderSortColumn').attr('draggable', 'true');
+ if (navigator.userAgent.indexOf("MSIE") != -1)
+ {
+ //call native IE dragDrop() to start dragging
+ grid.$root.find('.kgHeaderSortColumn').bind('selectstart', function () { this.dragDrop(); return false; });
+ }
} else {
grid.$root.find('.kgHeaderSortColumn').draggable({
helper: 'clone',
@@ -1891,7 +1896,7 @@ window.kg.StyleProvider = function (grid) {
};
/***********************************************
-* FILE: ..\src\classes\SortService.js
+* FILE: ..\src\classes\sortService.js
***********************************************/
window.kg.sortService = {
colSortFnCache: {}, // cache of sorting functions. Once we create them, we don't want to keep re-doing it
@@ -2144,7 +2149,7 @@ window.kg.sortService = {
};
/***********************************************
-* FILE: ..\src\classes\DomUtilityService.js
+* FILE: ..\src\classes\domUtilityService.js
***********************************************/
var getWidths = function () {
var $testContainer = $('<div></div>');
View
2 koGrid-2.1.1.js
@@ -38,7 +38,7 @@ self._visible(v);window.kg.domUtilityService.BuildStyles(grid);};self.showSortBu
var dir=self.sortDirection()===ASC?DESC:ASC;self.sortDirection(dir);config.sortCallback(self,dir);return false;};self.gripClick=function(data,event){event.stopPropagation();clicks++;if(clicks===1){timer=setTimeout(function(){clicks=0;},delay);}else{clearTimeout(timer);config.resizeOnDataCallback(self);clicks=0;}};self.gripOnMouseDown=function(event){event.stopPropagation();if(event.ctrlKey){self.toggleVisible();window.kg.domUtilityService.BuildStyles(grid);grid.config.columnsChanged(grid.columns.peek());return true;}
self.eventTaget=event.target.parentElement;self.eventTaget.style.cursor='col-resize';self.startMousePosition=event.clientX;self.origWidth=self.width;$(document).mousemove(self.onMouseMove);$(document).mouseup(self.gripOnMouseUp);return false;};self.onMouseMove=function(event){event.stopPropagation();var diff=event.clientX-self.startMousePosition;var newWidth=diff+self.origWidth;self.width=(newWidth<self.minWidth?self.minWidth:(newWidth>self.maxWidth?self.maxWidth:newWidth));window.kg.domUtilityService.BuildStyles(grid);return false;};self.gripOnMouseUp=function(event){event.stopPropagation();$(document).off('mousemove');$(document).off('mouseup');self.eventTaget.style.cursor=self.sortable()?'pointer':'default';self.eventTaget=undefined;grid.config.columnsChanged(grid.columns.peek());return false;};};window.kg.Dimension=function(options){this.outerHeight=null;this.outerWidth=null;$.extend(this,options);};window.kg.EventProvider=function(grid){var self=this;self.colToMove=undefined;self.groupToMove=undefined;self.assignEvents=function(){if(grid.config.jqueryUIDraggable){grid.$groupPanel.droppable({addClasses:false,drop:function(event){self.onGroupDrop(event);}});$(document).ready(self.setDraggables);}else{grid.$groupPanel.on('mousedown',self.onGroupMouseDown).on('dragover',self.dragOver).on('drop',self.onGroupDrop);grid.$headerScroller.on('mousedown',self.onHeaderMouseDown).on('dragover',self.dragOver).on('drop',self.onHeaderDrop);if(grid.config.enableRowReordering){grid.$viewport.on('mousedown',self.onRowMouseDown).on('dragover',self.dragOver).on('drop',self.onRowDrop);}
self.setDraggables();}
-grid.columns.subscribe(self.setDraggables);};self.dragOver=function(evt){evt.preventDefault();};self.setDraggables=function(){if(!grid.config.jqueryUIDraggable){grid.$root.find('.kgHeaderSortColumn').attr('draggable','true');}else{grid.$root.find('.kgHeaderSortColumn').draggable({helper:'clone',appendTo:'body',stack:'div',addClasses:false,start:function(event){self.onHeaderMouseDown(event);}}).droppable({drop:function(event){self.onHeaderDrop(event);}});}};self.onGroupMouseDown=function(event){var groupItem=$(event.target);if(groupItem[0].className!='kgRemoveGroup'){var groupItemScope=ko.dataFor(groupItem[0]);if(groupItemScope){if(!grid.config.jqueryUIDraggable){groupItem.attr('draggable','true');}
+grid.columns.subscribe(self.setDraggables);};self.dragOver=function(evt){evt.preventDefault();};self.setDraggables=function(){if(!grid.config.jqueryUIDraggable){grid.$root.find('.kgHeaderSortColumn').attr('draggable','true');if(navigator.userAgent.indexOf("MSIE")!=-1){grid.$root.find('.kgHeaderSortColumn').bind('selectstart',function(){this.dragDrop();return false;});}}else{grid.$root.find('.kgHeaderSortColumn').draggable({helper:'clone',appendTo:'body',stack:'div',addClasses:false,start:function(event){self.onHeaderMouseDown(event);}}).droppable({drop:function(event){self.onHeaderDrop(event);}});}};self.onGroupMouseDown=function(event){var groupItem=$(event.target);if(groupItem[0].className!='kgRemoveGroup'){var groupItemScope=ko.dataFor(groupItem[0]);if(groupItemScope){if(!grid.config.jqueryUIDraggable){groupItem.attr('draggable','true');}
self.groupToMove={header:groupItem,groupName:groupItemScope,index:groupItemScope.groupIndex()-1};}}else{self.groupToMove=undefined;}};self.onGroupDrop=function(event){var groupContainer;var groupScope;if(self.groupToMove){groupContainer=$(event.target).closest('.kgGroupElement');if(groupContainer.context.className=='kgGroupPanel'){grid.configGroups.splice(self.groupToMove.index,1);grid.configGroups.push(self.groupToMove.groupName);}else{groupScope=ko.dataFor(groupContainer[0]);if(groupScope){if(self.groupToMove.index!=groupScope.groupIndex()){grid.configGroups.splice(self.groupToMove.index,1);grid.configGroups.splice(groupScope.groupIndex(),0,self.groupToMove.groupName);}}}
self.groupToMove=undefined;grid.fixGroupIndexes();}else{if(grid.configGroups.indexOf(self.colToMove.col)==-1){groupContainer=$(event.target).closest('.kgGroupElement');if(groupContainer.context.className=='kgGroupPanel'||groupContainer.context.className=='kgGroupPanelDescription'){grid.groupBy(self.colToMove.col);}else{groupScope=ko.dataFor(groupContainer[0]);if(groupScope){grid.removeGroup(groupScope.groupIndex());}}}
self.colToMove=undefined;}};self.onHeaderMouseDown=function(event){var headerContainer=$(event.target).closest('.kgHeaderSortColumn');if(!headerContainer[0]){return true;}
View
5 src/classes/eventProvider.js
@@ -33,6 +33,11 @@ window.kg.EventProvider = function (grid) {
self.setDraggables = function(){
if(!grid.config.jqueryUIDraggable){
grid.$root.find('.kgHeaderSortColumn').attr('draggable', 'true');
+ if (navigator.userAgent.indexOf("MSIE") != -1)
+ {
+ //call native IE dragDrop() to start dragging
+ grid.$root.find('.kgHeaderSortColumn').bind('selectstart', function () { this.dragDrop(); return false; });
+ }
} else {
grid.$root.find('.kgHeaderSortColumn').draggable({
helper: 'clone',

0 comments on commit edf3776

Please sign in to comment.
Something went wrong with that request. Please try again.