datatables.net-colreorder
Advanced tools
Comparing version 1.3.2 to 1.3.3
@@ -1,2 +0,2 @@ | ||
/*! ColReorder 1.3.2 | ||
/*! ColReorder 1.3.3 | ||
* ©2010-2015 SpryMedia Ltd - datatables.net/license | ||
@@ -8,3 +8,3 @@ */ | ||
* @description Provide the ability to reorder columns in a DataTable | ||
* @version 1.3.2 | ||
* @version 1.3.3 | ||
* @file dataTables.colReorder.js | ||
@@ -891,6 +891,10 @@ * @author SpryMedia Ltd (www.sprymedia.co.uk) | ||
var that = this; | ||
$(nTh).on( 'mousedown.ColReorder', function (e) { | ||
e.preventDefault(); | ||
that._fnMouseDown.call( that, e, nTh ); | ||
} ); | ||
$(nTh) | ||
.on( 'mousedown.ColReorder', function (e) { | ||
e.preventDefault(); | ||
that._fnMouseDown.call( that, e, nTh ); | ||
} ) | ||
.on( 'touchstart.ColReorder', function (e) { | ||
that._fnMouseDown.call( that, e, nTh ); | ||
} ); | ||
}, | ||
@@ -920,6 +924,6 @@ | ||
this.s.mouse.startX = e.pageX; | ||
this.s.mouse.startY = e.pageY; | ||
this.s.mouse.offsetX = e.pageX - offset.left; | ||
this.s.mouse.offsetY = e.pageY - offset.top; | ||
this.s.mouse.startX = this._fnCursorPosition( e, 'pageX' ); | ||
this.s.mouse.startY = this._fnCursorPosition( e, 'pageY' ); | ||
this.s.mouse.offsetX = this._fnCursorPosition( e, 'pageX' ) - offset.left; | ||
this.s.mouse.offsetY = this._fnCursorPosition( e, 'pageY' ) - offset.top; | ||
this.s.mouse.target = this.s.dt.aoColumns[ idx ].nTh;//target[0]; | ||
@@ -933,6 +937,6 @@ this.s.mouse.targetIndex = idx; | ||
$(document) | ||
.on( 'mousemove.ColReorder', function (e) { | ||
.on( 'mousemove.ColReorder touchmove.ColReorder', function (e) { | ||
that._fnMouseMove.call( that, e ); | ||
} ) | ||
.on( 'mouseup.ColReorder', function (e) { | ||
.on( 'mouseup.ColReorder touchend.ColReorder', function (e) { | ||
that._fnMouseUp.call( that, e ); | ||
@@ -961,4 +965,4 @@ } ); | ||
if ( Math.pow( | ||
Math.pow(e.pageX - this.s.mouse.startX, 2) + | ||
Math.pow(e.pageY - this.s.mouse.startY, 2), 0.5 ) < 5 ) | ||
Math.pow(this._fnCursorPosition( e, 'pageX') - this.s.mouse.startX, 2) + | ||
Math.pow(this._fnCursorPosition( e, 'pageY') - this.s.mouse.startY, 2), 0.5 ) < 5 ) | ||
{ | ||
@@ -972,4 +976,4 @@ return; | ||
this.dom.drag.css( { | ||
left: e.pageX - this.s.mouse.offsetX, | ||
top: e.pageY - this.s.mouse.offsetY | ||
left: this._fnCursorPosition( e, 'pageX' ) - this.s.mouse.offsetX, | ||
top: this._fnCursorPosition( e, 'pageY' ) - this.s.mouse.offsetY | ||
} ); | ||
@@ -983,3 +987,3 @@ | ||
{ | ||
if ( e.pageX < this.s.aoTargets[i-1].x + ((this.s.aoTargets[i].x-this.s.aoTargets[i-1].x)/2) ) | ||
if ( this._fnCursorPosition(e, 'pageX') < this.s.aoTargets[i-1].x + ((this.s.aoTargets[i].x-this.s.aoTargets[i-1].x)/2) ) | ||
{ | ||
@@ -1021,3 +1025,3 @@ this.dom.pointer.css( 'left', this.s.aoTargets[i-1].x ); | ||
$(document).off( 'mousemove.ColReorder mouseup.ColReorder' ); | ||
$(document).off( '.ColReorder' ); | ||
@@ -1174,3 +1178,17 @@ if ( this.dom.drag !== null ) | ||
} ); | ||
} | ||
}, | ||
/** | ||
* Get cursor position regardless of mouse or touch input | ||
* @param {Event} e jQuery Event | ||
* @param {string} prop Property to get | ||
* @return {number} Value | ||
*/ | ||
_fnCursorPosition: function ( e, prop ) { | ||
if ( e.type.indexOf('touch') !== -1 ) { | ||
return e.originalEvent.touches[0][ prop ]; | ||
} | ||
return e[ prop ]; | ||
}, | ||
} ); | ||
@@ -1254,3 +1272,3 @@ | ||
*/ | ||
ColReorder.version = "1.3.2"; | ||
ColReorder.version = "1.3.3"; | ||
@@ -1257,0 +1275,0 @@ |
{ | ||
"name": "datatables.net-colreorder", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"description": "ColReorder for DataTables ", | ||
@@ -5,0 +5,0 @@ "files": [ |
# ColReorder for DataTables | ||
This package contains distribution files for the [ColReorder extension](https://datatables.net/extensions/colreorder) for [DataTables](https://datatables.net/). Only the core software for this library is contained in this package - to be correctly styled, a styling package for ColReorder must also be included. Styling options include DataTable's native styling, [Bootstrap](http://getboostrap.com) and [Foundation](http://foundation.zurb.com/). | ||
This package contains distribution files for the [ColReorder extension](https://datatables.net/extensions/colreorder) for [DataTables](https://datatables.net/). Only the core software for this library is contained in this package - to be correctly styled, a styling package for ColReorder must also be included. Styling options include DataTable's native styling, [Bootstrap](http://getbootstrap.com) and [Foundation](http://foundation.zurb.com/). | ||
@@ -5,0 +5,0 @@ ColReorder allows the end user to modify the column order of a table through drop-and-drag of column headers. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38998
1147