Changeset:
ce0d8e4bfead
https://sourceforge.net/p/mrbs/hg-code/ci/ce0d8e4bfeadaa9439dd00b0ccc65ccb35e382d8
Author:
Campbell Morrison <[email protected]>
Date:
Tue Sep 29 16:09:00 2015 +0100
Log message:
Updated to ColReorder 1.2.0
diffstat:
web/jquery/datatables/css/colReorder.dataTables.css | 10 +
web/jquery/datatables/css/colReorder.dataTables.min.css | 1 +
web/jquery/datatables/css/dataTables.colReorder.css | 14 -
web/jquery/datatables/css/dataTables.colReorder.min.css | 1 -
web/jquery/datatables/js/dataTables.colReorder.js | 363 +++++----------
web/jquery/datatables/js/dataTables.colReorder.min.js | 45 +-
web/style.inc | 4 +-
7 files changed, 158 insertions(+), 280 deletions(-)
diffs (truncated from 710 to 300 lines):
diff -r baccb27c1da0 -r ce0d8e4bfead
web/jquery/datatables/css/colReorder.dataTables.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/jquery/datatables/css/colReorder.dataTables.css Tue Sep 29
16:09:00 2015 +0100
@@ -0,0 +1,10 @@
+table.DTCR_clonedTable {
+ background-color: rgba(255, 255, 255, 0.7);
+ z-index: 202;
+}
+
+div.DTCR_pointer {
+ width: 1px;
+ background-color: #0259C4;
+ z-index: 201;
+}
diff -r baccb27c1da0 -r ce0d8e4bfead
web/jquery/datatables/css/colReorder.dataTables.min.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/jquery/datatables/css/colReorder.dataTables.min.css Tue Sep 29
16:09:00 2015 +0100
@@ -0,0 +1,1 @@
+table.DTCR_clonedTable{background-color:rgba(255,255,255,0.7);z-index:202}div.DTCR_pointer{width:1px;background-color:#0259C4;z-index:201}
diff -r baccb27c1da0 -r ce0d8e4bfead
web/jquery/datatables/css/dataTables.colReorder.css
--- a/web/jquery/datatables/css/dataTables.colReorder.css Tue Sep 29
15:55:13 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-/*
- * Namespace DTCR - "DataTables ColReorder" plug-in
- */
-
-table.DTCR_clonedTable {
- background-color: rgba(255, 255, 255, 0.7);
- z-index: 202;
-}
-
-div.DTCR_pointer {
- width: 1px;
- background-color: #0259C4;
- z-index: 201;
-}
\ No newline at end of file
diff -r baccb27c1da0 -r ce0d8e4bfead
web/jquery/datatables/css/dataTables.colReorder.min.css
--- a/web/jquery/datatables/css/dataTables.colReorder.min.css Tue Sep 29
15:55:13 2015 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-table.DTCR_clonedTable{background-color:rgba(255,255,255,0.7);z-index:202}div.DTCR_pointer{width:1px;background-color:#0259C4;z-index:201}
diff -r baccb27c1da0 -r ce0d8e4bfead
web/jquery/datatables/js/dataTables.colReorder.js
--- a/web/jquery/datatables/js/dataTables.colReorder.js Tue Sep 29 15:55:13
2015 +0100
+++ b/web/jquery/datatables/js/dataTables.colReorder.js Tue Sep 29 16:09:00
2015 +0100
@@ -1,11 +1,11 @@
-/*! ColReorder 1.1.2
+/*! ColReorder 1.2.0
* ©2010-2014 SpryMedia Ltd - datatables.net/license
*/
/**
* @summary ColReorder
* @description Provide the ability to reorder columns in a DataTable
- * @version 1.1.2
+ * @version 1.2.0
* @file dataTables.colReorder.js
* @author SpryMedia Ltd (www.sprymedia.co.uk)
* @contact www.sprymedia.co.uk/contact
@@ -90,13 +90,8 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * *
- * DataTables plug-in API functions
- *
- * This are required by ColReorder in order to perform the tasks required, and
also keep this
- * code portable, to be used for other column reordering projects with
DataTables, if needed.
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * */
-
+var factory = function( $, DataTable ) {
+"use strict";
/**
* Plug-in for DataTables which will reorder the internal column structure by
taking the column
@@ -109,10 +104,9 @@
*/
$.fn.dataTableExt.oApi.fnColReorder = function ( oSettings, iFrom, iTo )
{
- var v110 = $.fn.dataTable.Api ? true : false;
var i, iLen, j, jLen, iCols=oSettings.aoColumns.length, nTrs, oCol;
var attrMap = function ( obj, prop, mapping ) {
- if ( ! obj[ prop ] ) {
+ if ( ! obj[ prop ] || typeof obj[ prop ] === 'function' ) {
return;
}
@@ -185,17 +179,13 @@
}
// Update the column indexes
- if ( v110 ) {
- oCol.idx = aiInvertMapping[ oCol.idx ];
- }
+ oCol.idx = aiInvertMapping[ oCol.idx ];
}
- if ( v110 ) {
- // Update 1.10 optimised sort class removal variable
- $.each( oSettings.aLastSort, function (i, val) {
- oSettings.aLastSort[i].src = aiInvertMapping[ val.src ];
- } );
- }
+ // Update 1.10 optimised sort class removal variable
+ $.each( oSettings.aLastSort, function (i, val) {
+ oSettings.aLastSort[i].src = aiInvertMapping[ val.src ];
+ } );
/* Update the Get and Set functions for each column */
for ( i=0, iLen=iCols ; i<iLen ; i++ )
@@ -281,25 +271,15 @@
{
var data = oSettings.aoData[i];
- if ( v110 ) {
- // DataTables 1.10+
- if ( data.anCells ) {
- fnArraySwitch( data.anCells, iFrom, iTo );
- }
+ if ( data.anCells ) {
+ fnArraySwitch( data.anCells, iFrom, iTo );
+ }
- // For DOM sourced data, the invalidate will reread the
cell into
- // the data array, but for data sources as an array,
they need to
- // be flipped
- if ( data.src !== 'dom' && $.isArray( data._aData ) ) {
- fnArraySwitch( data._aData, iFrom, iTo );
- }
- }
- else {
- // DataTables 1.9-
- if ( $.isArray( data._aData ) ) {
- fnArraySwitch( data._aData, iFrom, iTo );
- }
- fnArraySwitch( data._anHidden, iFrom, iTo );
+ // For DOM sourced data, the invalidate will reread the cell
into
+ // the data array, but for data sources as an array, they need
to
+ // be flipped
+ if ( data.src !== 'dom' && $.isArray( data._aData ) ) {
+ fnArraySwitch( data._aData, iFrom, iTo );
}
}
@@ -317,11 +297,9 @@
}
}
- // In 1.10 we need to invalidate row cached data for sorting, filtering
etc
- if ( v110 ) {
- var api = new $.fn.dataTable.Api( oSettings );
- api.rows().invalidate();
- }
+ // Invalidate row cached data for sorting, filtering etc
+ var api = new $.fn.dataTable.Api( oSettings );
+ api.rows().invalidate();
/*
* Update DataTables' event handlers
@@ -336,18 +314,19 @@
/* Fire an event so other plug-ins can update */
- $(oSettings.oInstance).trigger( 'column-reorder', [ oSettings, {
- "iFrom": iFrom,
- "iTo": iTo,
- "aiInvertMapping": aiInvertMapping
+ $(oSettings.oInstance).trigger( 'column-reorder.dt', [ oSettings, {
+ from: iFrom,
+ to: iTo,
+ mapping: aiInvertMapping,
+
+ // Old style parameters for compatibility
+ iFrom: iFrom,
+ iTo: iTo,
+ aiInvertMapping: aiInvertMapping
} ] );
};
-
-var factory = function( $, DataTable ) {
-"use strict";
-
/**
* ColReorder provides column visibility control for DataTables
* @class ColReorder
@@ -357,37 +336,16 @@
*/
var ColReorder = function( dt, opts )
{
- var oDTSettings;
+ var settings = new $.fn.dataTable.Api( dt ).settings()[0];
- if ( $.fn.dataTable.Api ) {
- oDTSettings = new $.fn.dataTable.Api( dt ).settings()[0];
+ // Ensure that we can't initialise on the same table twice
+ if ( settings._colReorder ) {
+ return settings._colReorder;
}
- // 1.9 compatibility
- else if ( dt.fnSettings ) {
- // DataTables object, convert to the settings object
- oDTSettings = dt.fnSettings();
- }
- else if ( typeof dt === 'string' ) {
- // jQuery selector
- if ( $.fn.dataTable.fnIsDataTable( $(dt)[0] ) ) {
- oDTSettings = $(dt).eq(0).dataTable().fnSettings();
- }
- }
- else if ( dt.nodeName && dt.nodeName.toLowerCase() === 'table' ) {
- // Table node
- if ( $.fn.dataTable.fnIsDataTable( dt.nodeName ) ) {
- oDTSettings = $(dt.nodeName).dataTable().fnSettings();
- }
- }
- else if ( dt instanceof jQuery ) {
- // jQuery object
- if ( $.fn.dataTable.fnIsDataTable( dt[0] ) ) {
- oDTSettings = dt.eq(0).dataTable().fnSettings();
- }
- }
- else {
- // DataTables settings object
- oDTSettings = dt;
+
+ // Allow the options to be a boolean for defaults
+ if ( opts === true ) {
+ opts = {};
}
// Convert from camelCase to Hungarian, just as DataTables does
@@ -440,11 +398,11 @@
/**
* Callback function for once the reorder has been done
- * @property dropcallback
+ * @property reorderCallback
* @type function
* @default null
*/
- "dropCallback": null,
+ "reorderCallback": null,
/**
* @namespace Information used for the mouse drag
@@ -495,13 +453,10 @@
/* Constructor logic */
- this.s.dt = oDTSettings.oInstance.fnSettings();
+ this.s.dt = settings;
this.s.dt._colReorder = this;
this._fnConstruct();
- /* Add destroy callback */
- oDTSettings.oApi._fnCallbackReg(oDTSettings, 'aoDestroyCallback',
$.proxy(this._fnDestroy, this), 'ColReorder');
-
return this;
};
@@ -621,6 +576,7 @@
{
var that = this;
var iLen = this.s.dt.aoColumns.length;
+ var table = this.s.dt.nTable;
var i;
/* Columns discounted from reordering - counting left to right
*/
@@ -629,6 +585,11 @@
this.s.fixed = this.s.init.iFixedColumns;
}
+ if ( this.s.init.iFixedColumnsLeft )
+ {
+ this.s.fixed = this.s.init.iFixedColumnsLeft;
+ }
+
/* Columns discounted from reordering - counting right to left
*/
this.s.fixedRight = this.s.init.iFixedColumnsRight ?
this.s.init.iFixedColumnsRight :
@@ -637,7 +598,7 @@
/* Drop callback initialisation option */
if ( this.s.init.fnReorderCallback )
{
- this.s.dropCallback = this.s.init.fnReorderCallback;
+ this.s.reorderCallback = this.s.init.fnReorderCallback;
}
/* Add event handlers for the drag and drop, and also mark the
original column order */
@@ -680,16 +641,13 @@
if ( !that.s.dt._bInitComplete )
{
var bDone = false;
- this.s.dt.aoDrawCallback.push( {
- "fn": function () {
- if ( !that.s.dt._bInitComplete
&& !bDone )
- {
------------------------------------------------------------------------------
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits