Run pre-commit on legacy code
This commit is contained in:
parent
fea11ac752
commit
83b7e4162e
323 changed files with 6126 additions and 6462 deletions
|
@ -15,4 +15,4 @@
|
|||
"sNext": "Επόμενη",
|
||||
"sLast": "Τελευταία"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,4 +20,4 @@
|
|||
"sSortAscending": ": activate to sort column ascending",
|
||||
"sSortDescending": ": activate to sort column descending"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,4 +20,4 @@
|
|||
"sSortAscending": ": activate to sort column ascending",
|
||||
"sSortDescending": ": activate to sort column descending"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,4 +22,4 @@
|
|||
"sSortAscending": ": Activar para ordernar la columna de manera ascendente",
|
||||
"sSortDescending": ": Activar para ordernar la columna de manera descendente"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,4 +19,4 @@
|
|||
"sSortAscending": ": activer pour trier la colonne par ordre croissant",
|
||||
"sSortDescending": ": activer pour trier la colonne par ordre décroissant"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,4 +16,4 @@
|
|||
"sNext": "Következő",
|
||||
"sLast": "Utolsó"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,4 +20,4 @@
|
|||
"sSortAscending": ": attiva per ordinare la colonna in ordine crescente",
|
||||
"sSortDescending": ": attiva per ordinare la colonna in ordine decrescente"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,4 +20,4 @@
|
|||
"sSortAscending": ": 오름차순으로 정렬",
|
||||
"sSortDescending": ": 내림차순으로 정렬"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,4 +15,4 @@
|
|||
"sNext": "Następna",
|
||||
"sLast": "Ostatnia"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,4 +14,4 @@
|
|||
"sNext": "Следующая",
|
||||
"sLast": "Последняя"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,4 +16,4 @@
|
|||
"sNext": "Napred",
|
||||
"sLast": "Zadnja"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,4 +14,4 @@
|
|||
"sNext": "下页",
|
||||
"sLast": "末页"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
* Version: 1.9.4
|
||||
* Author: Allan Jardine (www.sprymedia.co.uk)
|
||||
* Info: www.datatables.net
|
||||
*
|
||||
*
|
||||
* Copyright 2008-2012 Allan Jardine, all rights reserved.
|
||||
*
|
||||
* This source file is free software, under either the GPL v2 license or a
|
||||
* BSD style license, available at:
|
||||
* http://datatables.net/license_gpl2
|
||||
* http://datatables.net/license_bsd
|
||||
*
|
||||
* This source file is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
*
|
||||
* This source file is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
|
||||
*/
|
||||
(function(X,l,n){var L=function(h){var j=function(e){function o(a,b){var c=j.defaults.columns,d=a.aoColumns.length,c=h.extend({},j.models.oColumn,c,{sSortingClass:a.oClasses.sSortable,sSortingClassJUI:a.oClasses.sSortJUI,nTh:b?b:l.createElement("th"),sTitle:c.sTitle?c.sTitle:b?b.innerHTML:"",aDataSort:c.aDataSort?c.aDataSort:[d],mData:c.mData?c.oDefaults:d});a.aoColumns.push(c);if(a.aoPreSearchCols[d]===n||null===a.aoPreSearchCols[d])a.aoPreSearchCols[d]=h.extend({},j.models.oSearch);else if(c=a.aoPreSearchCols[d],
|
||||
|
|
|
@ -44,7 +44,7 @@ denise@denise-DX4860:~/airtime/legacy/public/js/datatables/plugin$ diff -u dataT
|
|||
+ if (oTable.fnSettings().oFeatures.bServerSide && iFilterLength != 0) {
|
||||
+ //If filter length is set in the server-side processing mode
|
||||
+ //Check has the user entered at least iFilterLength new characters
|
||||
+
|
||||
+
|
||||
+ var currentFilter = oTable.fnSettings().aoPreSearchCols[index].sSearch;
|
||||
+ var iLastFilterLength = $(this).data("dt-iLastFilterLength");
|
||||
+ if (typeof iLastFilterLength == "undefined")
|
||||
|
@ -70,7 +70,7 @@ denise@denise-DX4860:~/airtime/legacy/public/js/datatables/plugin$ diff -u dataT
|
|||
- fnOnFiltered();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -168,7 +172,8 @@
|
||||
input.blur(function () {
|
||||
if (this.value == "") {
|
||||
|
@ -83,9 +83,9 @@ denise@denise-DX4860:~/airtime/legacy/public/js/datatables/plugin$ diff -u dataT
|
|||
}
|
||||
@@ -176,13 +181,25 @@
|
||||
function fnCreateRangeInput(oTable) {
|
||||
|
||||
|
||||
//var currentFilter = oTable.fnSettings().aoPreSearchCols[i].sSearch;
|
||||
+
|
||||
+
|
||||
+ var label = "";
|
||||
+ if (th.attr('id') == "bit_rate") {
|
||||
+ label = $.i18n._("kbps");
|
||||
|
@ -96,7 +96,7 @@ denise@denise-DX4860:~/airtime/legacy/public/js/datatables/plugin$ diff -u dataT
|
|||
+ } else if (th.attr('id') == "sample_rate") {
|
||||
+ label = $.i18n._("kHz");
|
||||
+ }
|
||||
+
|
||||
+
|
||||
th.html(_fnRangeLabelPart(0));
|
||||
var sFromId = oTable.attr("id") + '_range_from_' + i;
|
||||
- var from = $('<input type="text" class="number_range_filter" id="' + sFromId + '" rel="' + i + '"/>');
|
||||
|
@ -110,8 +110,8 @@ denise@denise-DX4860:~/airtime/legacy/public/js/datatables/plugin$ diff -u dataT
|
|||
th.append(_fnRangeLabelPart(2));
|
||||
th.wrapInner('<span class="filterColumn filter_number_range" />');
|
||||
@@ -228,14 +245,16 @@
|
||||
|
||||
|
||||
|
||||
|
||||
$('#' + sFromId + ',#' + sToId, th).keyup(function () {
|
||||
-
|
||||
- var iMin = document.getElementById(sFromId).value * 1;
|
||||
|
@ -127,13 +127,13 @@ denise@denise-DX4860:~/airtime/legacy/public/js/datatables/plugin$ diff -u dataT
|
|||
+ var iMax = document.getElementById(sToId).value * 1;
|
||||
+ if (iMin != 0 && iMax != 0 && iMin > iMax)
|
||||
+ return;
|
||||
+
|
||||
+
|
||||
+ oTable.fnDraw();
|
||||
+ fnOnFiltered();
|
||||
+ }
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -566,7 +585,7 @@
|
||||
sRangeSeparator: "~",
|
||||
iFilteringDelay: 500,
|
||||
|
@ -141,12 +141,12 @@ denise@denise-DX4860:~/airtime/legacy/public/js/datatables/plugin$ diff -u dataT
|
|||
- sRangeFormat: "From {from} to {to}"
|
||||
+ sRangeFormat: $.i18n._("From {from} to {to}")
|
||||
};
|
||||
|
||||
|
||||
properties = $.extend(defaults, options);
|
||||
@@ -730,4 +749,4 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
-})(jQuery);
|
||||
\ No newline at end of file
|
||||
+})(jQuery);
|
||||
+})(jQuery);
|
||||
|
|
|
@ -14,20 +14,19 @@ The new _fnDomBaseButton looks like this:
|
|||
nButton = document.createElement('button'),
|
||||
nSpan = document.createElement('span'),
|
||||
sEvent = this.s.activate=="mouseover" ? "mouseover" : "click";
|
||||
|
||||
|
||||
//nButton.className = !this.s.dt.bJUI ? "ColVis_Button TableTools_Button" :
|
||||
//"ColVis_Button TableTools_Button ui-button ui-state-default";
|
||||
nButton.className = "btn-toolbar btn btn-small dropdown-toggle ColVis_MasterButton";
|
||||
|
||||
|
||||
nButton.appendChild( nSpan );
|
||||
$(nButton).append("<span class='caret'></span>");
|
||||
nSpan.innerHTML = text;
|
||||
|
||||
|
||||
$(nButton).bind( 'click', function (e) {
|
||||
that._fnCollectionShow();
|
||||
e.preventDefault();
|
||||
} );
|
||||
|
||||
|
||||
return nButton;
|
||||
},
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
* License: GPL v2 or BSD 3 point style
|
||||
* Project: Just a little bit of fun :-)
|
||||
* Contact: www.sprymedia.co.uk/contact
|
||||
*
|
||||
*
|
||||
* Copyright 2010-2011 Allan Jardine, all rights reserved.
|
||||
*
|
||||
* This source file is free software, under either the GPL v2 license or a
|
||||
|
@ -21,7 +21,7 @@
|
|||
|
||||
(function($) {
|
||||
|
||||
/**
|
||||
/**
|
||||
* ColVis provides column visiblity control for DataTables
|
||||
* @class ColVis
|
||||
* @constructor
|
||||
|
@ -34,17 +34,17 @@ ColVis = function( oDTSettings, oInit )
|
|||
{
|
||||
alert( "Warning: ColVis must be initialised with the keyword 'new'" );
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oInit == 'undefined' )
|
||||
{
|
||||
oInit = {};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Public class variables
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
|
||||
/**
|
||||
* @namespace Settings object which contains customisable information for ColVis instance
|
||||
*/
|
||||
|
@ -56,7 +56,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default null
|
||||
*/
|
||||
"dt": null,
|
||||
|
||||
|
||||
/**
|
||||
* Customisation object
|
||||
* @property oInit
|
||||
|
@ -64,7 +64,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default passed in
|
||||
*/
|
||||
"oInit": oInit,
|
||||
|
||||
|
||||
/**
|
||||
* Callback function to tell the user when the state has changed
|
||||
* @property fnStateChange
|
||||
|
@ -72,7 +72,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default null
|
||||
*/
|
||||
"fnStateChange": null,
|
||||
|
||||
|
||||
/**
|
||||
* Mode of activation. Can be 'click' or 'mouseover'
|
||||
* @property activate
|
||||
|
@ -80,7 +80,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default click
|
||||
*/
|
||||
"activate": "click",
|
||||
|
||||
|
||||
/**
|
||||
* Position of the collection menu when shown - align "left" or "right"
|
||||
* @property sAlign
|
||||
|
@ -88,7 +88,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default right
|
||||
*/
|
||||
"sAlign": "left",
|
||||
|
||||
|
||||
/**
|
||||
* Text used for the button
|
||||
* @property buttonText
|
||||
|
@ -96,7 +96,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default Show / hide columns
|
||||
*/
|
||||
"buttonText": "Show / hide columns",
|
||||
|
||||
|
||||
/**
|
||||
* Flag to say if the collection is hidden
|
||||
* @property hidden
|
||||
|
@ -104,7 +104,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default true
|
||||
*/
|
||||
"hidden": true,
|
||||
|
||||
|
||||
/**
|
||||
* List of columns (integers) which should be excluded from the list
|
||||
* @property aiExclude
|
||||
|
@ -112,7 +112,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default []
|
||||
*/
|
||||
"aiExclude": [],
|
||||
|
||||
|
||||
/**
|
||||
* Store the original viisbility settings so they could be restored
|
||||
* @property abOriginal
|
||||
|
@ -120,7 +120,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default []
|
||||
*/
|
||||
"abOriginal": [],
|
||||
|
||||
|
||||
/**
|
||||
* Show Show-All button
|
||||
* @property bShowAll
|
||||
|
@ -128,7 +128,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default []
|
||||
*/
|
||||
"bShowAll": false,
|
||||
|
||||
|
||||
/**
|
||||
* Show All button text
|
||||
* @property sShowAll
|
||||
|
@ -136,7 +136,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default Restore original
|
||||
*/
|
||||
"sShowAll": "Show All",
|
||||
|
||||
|
||||
/**
|
||||
* Show restore button
|
||||
* @property bRestore
|
||||
|
@ -144,7 +144,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default []
|
||||
*/
|
||||
"bRestore": false,
|
||||
|
||||
|
||||
/**
|
||||
* Restore button text
|
||||
* @property sRestore
|
||||
|
@ -152,7 +152,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default Restore original
|
||||
*/
|
||||
"sRestore": "Restore original",
|
||||
|
||||
|
||||
/**
|
||||
* Overlay animation duration in mS
|
||||
* @property iOverlayFade
|
||||
|
@ -160,7 +160,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default 500
|
||||
*/
|
||||
"iOverlayFade": 500,
|
||||
|
||||
|
||||
/**
|
||||
* Label callback for column names. Takes three parameters: 1. the column index, 2. the column
|
||||
* title detected by DataTables and 3. the TH node for the column
|
||||
|
@ -169,7 +169,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default null
|
||||
*/
|
||||
"fnLabel": null,
|
||||
|
||||
|
||||
/**
|
||||
* Indicate if ColVis should automatically calculate the size of buttons or not. The default
|
||||
* is for it to do so. Set to "css" to disable the automatic sizing
|
||||
|
@ -178,7 +178,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default auto
|
||||
*/
|
||||
"sSize": "auto",
|
||||
|
||||
|
||||
/**
|
||||
* Indicate if the column list should be positioned by Javascript, visually below the button
|
||||
* or allow CSS to do the positioning
|
||||
|
@ -188,8 +188,8 @@ ColVis = function( oDTSettings, oInit )
|
|||
*/
|
||||
"bCssPosition": false
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @namespace Common and useful DOM elements for the class instance
|
||||
*/
|
||||
|
@ -201,7 +201,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default null
|
||||
*/
|
||||
"wrapper": null,
|
||||
|
||||
|
||||
/**
|
||||
* Activation button
|
||||
* @property button
|
||||
|
@ -209,7 +209,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default null
|
||||
*/
|
||||
"button": null,
|
||||
|
||||
|
||||
/**
|
||||
* Collection list node
|
||||
* @property collection
|
||||
|
@ -217,7 +217,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default null
|
||||
*/
|
||||
"collection": null,
|
||||
|
||||
|
||||
/**
|
||||
* Background node used for shading the display and event capturing
|
||||
* @property background
|
||||
|
@ -225,7 +225,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default null
|
||||
*/
|
||||
"background": null,
|
||||
|
||||
|
||||
/**
|
||||
* Element to position over the activation button to catch mouse events when using mouseover
|
||||
* @property catcher
|
||||
|
@ -233,7 +233,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default null
|
||||
*/
|
||||
"catcher": null,
|
||||
|
||||
|
||||
/**
|
||||
* List of button elements
|
||||
* @property buttons
|
||||
|
@ -241,7 +241,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default []
|
||||
*/
|
||||
"buttons": [],
|
||||
|
||||
|
||||
/**
|
||||
* Restore button
|
||||
* @property restore
|
||||
|
@ -250,10 +250,10 @@ ColVis = function( oDTSettings, oInit )
|
|||
*/
|
||||
"restore": null
|
||||
};
|
||||
|
||||
|
||||
/* Store global reference */
|
||||
ColVis.aInstances.push( this );
|
||||
|
||||
|
||||
/* Constructor logic */
|
||||
this.s.dt = oDTSettings;
|
||||
this._fnConstruct();
|
||||
|
@ -266,7 +266,7 @@ ColVis.prototype = {
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Public methods
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
|
||||
/**
|
||||
* Rebuild the list of buttons for this instance (i.e. if there is a column header update)
|
||||
* @method fnRebuild
|
||||
|
@ -283,56 +283,56 @@ ColVis.prototype = {
|
|||
}
|
||||
}
|
||||
this.dom.buttons.splice( 0, this.dom.buttons.length );
|
||||
|
||||
|
||||
if ( this.dom.restore )
|
||||
{
|
||||
this.dom.restore.parentNode( this.dom.restore );
|
||||
}
|
||||
|
||||
|
||||
/* Re-add them (this is not the optimal way of doing this, it is fast and effective) */
|
||||
this._fnAddButtons();
|
||||
|
||||
|
||||
/* Update the checkboxes */
|
||||
this._fnDrawCallback();
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Private methods (they are of course public in JS, but recommended as private)
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
|
||||
/**
|
||||
* Constructor logic
|
||||
* @method _fnConstruct
|
||||
* @returns void
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnConstruct": function ()
|
||||
{
|
||||
this._fnApplyCustomisation();
|
||||
|
||||
|
||||
var that = this;
|
||||
var i, iLen;
|
||||
this.dom.wrapper = document.createElement('div');
|
||||
this.dom.wrapper.className = "ColVis TableTools";
|
||||
|
||||
|
||||
this.dom.button = this._fnDomBaseButton( this.s.buttonText );
|
||||
this.dom.button.className += " ColVis_MasterButton";
|
||||
this.dom.wrapper.appendChild( this.dom.button );
|
||||
|
||||
|
||||
this.dom.catcher = this._fnDomCatcher();
|
||||
this.dom.collection = this._fnDomCollection();
|
||||
this.dom.background = this._fnDomBackground();
|
||||
|
||||
|
||||
this._fnAddButtons();
|
||||
|
||||
|
||||
/* Store the original visbility information */
|
||||
for ( i=0, iLen=this.s.dt.aoColumns.length ; i<iLen ; i++ )
|
||||
{
|
||||
this.s.abOriginal.push( this.s.dt.aoColumns[i].bVisible );
|
||||
}
|
||||
|
||||
|
||||
/* Update on each draw */
|
||||
this.s.dt.aoDrawCallback.push( {
|
||||
"fn": function () {
|
||||
|
@ -351,77 +351,77 @@ ColVis.prototype = {
|
|||
|
||||
var mStore = that.s.abOriginal.splice( oReorder.iFrom, 1 )[0];
|
||||
that.s.abOriginal.splice( oReorder.iTo, 0, mStore );
|
||||
|
||||
|
||||
that.fnRebuild();
|
||||
} );
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Apply any customisation to the settings from the DataTables initialisation
|
||||
* @method _fnApplyCustomisation
|
||||
* @returns void
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnApplyCustomisation": function ()
|
||||
{
|
||||
var oConfig = this.s.oInit;
|
||||
|
||||
|
||||
if ( typeof oConfig.activate != 'undefined' )
|
||||
{
|
||||
this.s.activate = oConfig.activate;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oConfig.buttonText != 'undefined' )
|
||||
{
|
||||
this.s.buttonText = oConfig.buttonText;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oConfig.aiExclude != 'undefined' )
|
||||
{
|
||||
this.s.aiExclude = oConfig.aiExclude;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oConfig.bRestore != 'undefined' )
|
||||
{
|
||||
this.s.bRestore = oConfig.bRestore;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oConfig.sRestore != 'undefined' )
|
||||
{
|
||||
this.s.sRestore = oConfig.sRestore;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oConfig.bShowAll != 'undefined' )
|
||||
{
|
||||
this.s.bShowAll = oConfig.bShowAll;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oConfig.sShowAll != 'undefined' )
|
||||
{
|
||||
this.s.sShowAll = oConfig.sShowAll;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oConfig.sAlign != 'undefined' )
|
||||
{
|
||||
this.s.sAlign = oConfig.sAlign;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oConfig.fnStateChange != 'undefined' )
|
||||
{
|
||||
this.s.fnStateChange = oConfig.fnStateChange;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oConfig.iOverlayFade != 'undefined' )
|
||||
{
|
||||
this.s.iOverlayFade = oConfig.iOverlayFade;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oConfig.fnLabel != 'undefined' )
|
||||
{
|
||||
this.s.fnLabel = oConfig.fnLabel;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oConfig.sSize != 'undefined' )
|
||||
{
|
||||
this.s.sSize = oConfig.sSize;
|
||||
|
@ -432,19 +432,19 @@ ColVis.prototype = {
|
|||
this.s.bCssPosition = oConfig.bCssPosition;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* On each table draw, check the visibility checkboxes as needed. This allows any process to
|
||||
* update the table's column visibility and ColVis will still be accurate.
|
||||
* @method _fnDrawCallback
|
||||
* @returns void
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnDrawCallback": function ()
|
||||
{
|
||||
var aoColumns = this.s.dt.aoColumns;
|
||||
|
||||
|
||||
for ( var i=0, iLen=aoColumns.length ; i<iLen ; i++ )
|
||||
{
|
||||
if ( this.dom.buttons[i] !== null )
|
||||
|
@ -460,20 +460,20 @@ ColVis.prototype = {
|
|||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Loop through the columns in the table and as a new button for each one.
|
||||
* @method _fnAddButtons
|
||||
* @returns void
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnAddButtons": function ()
|
||||
{
|
||||
var
|
||||
nButton,
|
||||
sExclude = ","+this.s.aiExclude.join(',')+",";
|
||||
|
||||
|
||||
for ( var i=0, iLen=this.s.dt.aoColumns.length ; i<iLen ; i++ )
|
||||
{
|
||||
if ( sExclude.indexOf( ","+i+"," ) == -1 )
|
||||
|
@ -487,7 +487,7 @@ ColVis.prototype = {
|
|||
this.dom.buttons.push( null );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( this.s.bRestore )
|
||||
{
|
||||
nButton = this._fnDomRestoreButton();
|
||||
|
@ -495,7 +495,7 @@ ColVis.prototype = {
|
|||
this.dom.buttons.push( nButton );
|
||||
this.dom.collection.appendChild( nButton );
|
||||
}
|
||||
|
||||
|
||||
if ( this.s.bShowAll )
|
||||
{
|
||||
nButton = this._fnDomShowAllButton();
|
||||
|
@ -504,13 +504,13 @@ ColVis.prototype = {
|
|||
this.dom.collection.appendChild( nButton );
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create a button which allows a "restore" action
|
||||
* @method _fnDomRestoreButton
|
||||
* @returns {Node} Created button
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnDomRestoreButton": function ()
|
||||
{
|
||||
|
@ -518,12 +518,12 @@ ColVis.prototype = {
|
|||
that = this,
|
||||
nButton = document.createElement('button'),
|
||||
nSpan = document.createElement('span');
|
||||
|
||||
|
||||
nButton.className = !this.s.dt.bJUI ? "ColVis_Button TableTools_Button" :
|
||||
"ColVis_Button TableTools_Button ui-button ui-state-default";
|
||||
nButton.appendChild( nSpan );
|
||||
$(nSpan).html( '<span class="ColVis_title">'+this.s.sRestore+'</span>' );
|
||||
|
||||
|
||||
$(nButton).click( function (e) {
|
||||
for ( var i=0, iLen=that.s.abOriginal.length ; i<iLen ; i++ )
|
||||
{
|
||||
|
@ -533,16 +533,16 @@ ColVis.prototype = {
|
|||
that.s.dt.oInstance.fnAdjustColumnSizing( false );
|
||||
that.s.dt.oInstance.fnDraw( false );
|
||||
} );
|
||||
|
||||
|
||||
return nButton;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create a button which allows a "show all" action
|
||||
* @method _fnDomShowAllButton
|
||||
* @returns {Node} Created button
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnDomShowAllButton": function ()
|
||||
{
|
||||
|
@ -550,12 +550,12 @@ ColVis.prototype = {
|
|||
that = this,
|
||||
nButton = document.createElement('button'),
|
||||
nSpan = document.createElement('span');
|
||||
|
||||
|
||||
nButton.className = !this.s.dt.bJUI ? "ColVis_Button TableTools_Button" :
|
||||
"ColVis_Button TableTools_Button ui-button ui-state-default";
|
||||
nButton.appendChild( nSpan );
|
||||
$(nSpan).html( '<span class="ColVis_title">'+this.s.sShowAll+'</span>' );
|
||||
|
||||
|
||||
$(nButton).click( function (e) {
|
||||
for ( var i=0, iLen=that.s.abOriginal.length ; i<iLen ; i++ )
|
||||
{
|
||||
|
@ -568,17 +568,17 @@ ColVis.prototype = {
|
|||
that.s.dt.oInstance.fnAdjustColumnSizing( false );
|
||||
that.s.dt.oInstance.fnDraw( false );
|
||||
} );
|
||||
|
||||
|
||||
return nButton;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create the DOM for a show / hide button
|
||||
* @method _fnDomColumnButton
|
||||
* @param {int} i Column in question
|
||||
* @returns {Node} Created button
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnDomColumnButton": function ( i )
|
||||
{
|
||||
|
@ -588,23 +588,23 @@ ColVis.prototype = {
|
|||
nButton = document.createElement('button'),
|
||||
nSpan = document.createElement('span'),
|
||||
dt = this.s.dt;
|
||||
|
||||
|
||||
nButton.className = !dt.bJUI ? "ColVis_Button TableTools_Button" :
|
||||
"ColVis_Button TableTools_Button ui-button ui-state-default";
|
||||
|
||||
|
||||
nButton.appendChild( nSpan );
|
||||
var sTitle = this.s.fnLabel===null ? oColumn.sTitle : this.s.fnLabel( i, oColumn.sTitle, oColumn.nTh );
|
||||
$(nSpan).html(
|
||||
'<span class="ColVis_radio"><input type="checkbox"/></span>'+
|
||||
'<span class="ColVis_title">'+sTitle+'</span>' );
|
||||
|
||||
|
||||
$(nButton).click( function (e) {
|
||||
var showHide = !$('input', this).is(":checked");
|
||||
if ( e.target.nodeName.toLowerCase() == "input" )
|
||||
{
|
||||
showHide = $('input', this).is(":checked");
|
||||
}
|
||||
|
||||
|
||||
/* Need to consider the case where the initialiser created more than one table - change the
|
||||
* API index that DataTables is using
|
||||
*/
|
||||
|
@ -625,22 +625,22 @@ ColVis.prototype = {
|
|||
}
|
||||
|
||||
$.fn.dataTableExt.iApiIndex = oldIndex; /* Restore */
|
||||
|
||||
|
||||
if ( that.s.fnStateChange !== null )
|
||||
{
|
||||
that.s.fnStateChange.call( that, i, showHide );
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
return nButton;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the position in the DataTables instance array of the table for this instance of ColVis
|
||||
* @method _fnDataTablesApiIndex
|
||||
* @returns {int} Index
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnDataTablesApiIndex": function ()
|
||||
{
|
||||
|
@ -653,14 +653,14 @@ ColVis.prototype = {
|
|||
}
|
||||
return 0;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create the DOM needed for the button and apply some base properties. All buttons start here
|
||||
* @method _fnDomBaseButton
|
||||
* @param {String} text Button text
|
||||
* @returns {Node} DIV element for the button
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnDomBaseButton": function ( text )
|
||||
{
|
||||
|
@ -670,28 +670,28 @@ ColVis.prototype = {
|
|||
nCaret = document.createElement('span'),
|
||||
nSpan = document.createElement('span'),
|
||||
sEvent = this.s.activate=="mouseover" ? "mouseover" : "click";
|
||||
|
||||
|
||||
nButton.className = "btn-toolbar btn btn-small dropdown-toggle";
|
||||
nCaret.className = "caret";
|
||||
|
||||
|
||||
nButton.appendChild( nSpan );
|
||||
nButton.appendChild( nCaret );
|
||||
nSpan.innerHTML = text;
|
||||
|
||||
|
||||
$(nButton).bind( sEvent, function (e) {
|
||||
that._fnCollectionShow();
|
||||
e.preventDefault();
|
||||
} );
|
||||
|
||||
|
||||
return nButton;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create the element used to contain list the columns (it is shown and hidden as needed)
|
||||
* @method _fnDomCollection
|
||||
* @returns {Node} div container for the collection
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnDomCollection": function ()
|
||||
{
|
||||
|
@ -700,60 +700,60 @@ ColVis.prototype = {
|
|||
nHidden.style.display = "none";
|
||||
nHidden.className = !this.s.dt.bJUI ? "ColVis_collection TableTools_collection" :
|
||||
"ColVis_collection TableTools_collection ui-buttonset ui-buttonset-multi";
|
||||
|
||||
|
||||
if ( !this.s.bCssPosition )
|
||||
{
|
||||
nHidden.style.position = "absolute";
|
||||
}
|
||||
$(nHidden).css('opacity', 0);
|
||||
|
||||
|
||||
return nHidden;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* An element to be placed on top of the activate button to catch events
|
||||
* @method _fnDomCatcher
|
||||
* @returns {Node} div container for the collection
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnDomCatcher": function ()
|
||||
{
|
||||
var
|
||||
var
|
||||
that = this,
|
||||
nCatcher = document.createElement('div');
|
||||
nCatcher.className = "ColVis_catcher TableTools_catcher";
|
||||
|
||||
|
||||
$(nCatcher).click( function () {
|
||||
that._fnCollectionHide.call( that, null, null );
|
||||
} );
|
||||
|
||||
|
||||
return nCatcher;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create the element used to shade the background, and capture hide events (it is shown and
|
||||
* Create the element used to shade the background, and capture hide events (it is shown and
|
||||
* hidden as needed)
|
||||
* @method _fnDomBackground
|
||||
* @returns {Node} div container for the background
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnDomBackground": function ()
|
||||
{
|
||||
var that = this;
|
||||
|
||||
|
||||
var nBackground = document.createElement('div');
|
||||
nBackground.style.position = "absolute";
|
||||
nBackground.style.left = "0px";
|
||||
nBackground.style.top = "0px";
|
||||
nBackground.className = "ColVis_collectionBackground TableTools_collectionBackground";
|
||||
$(nBackground).css('opacity', 0);
|
||||
|
||||
|
||||
$(nBackground).click( function () {
|
||||
that._fnCollectionHide.call( that, null, null );
|
||||
} );
|
||||
|
||||
|
||||
/* When considering a mouse over action for the activation, we also consider a mouse out
|
||||
* which is the same as a mouse over the background - without all the messing around of
|
||||
* bubbling events. Use the catcher element to avoid messing around with bubbling
|
||||
|
@ -765,16 +765,16 @@ ColVis.prototype = {
|
|||
that._fnCollectionHide.call( that, null, null );
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
return nBackground;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Show the show / hide list and the background
|
||||
* @method _fnCollectionShow
|
||||
* @returns void
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnCollectionShow": function ()
|
||||
{
|
||||
|
@ -784,7 +784,7 @@ ColVis.prototype = {
|
|||
var nBackground = this.dom.background;
|
||||
var iDivX = parseInt(oPos.left, 10);
|
||||
var iDivY = parseInt(oPos.top + $(this.dom.button).outerHeight(), 10);
|
||||
|
||||
|
||||
if ( !this.s.bCssPosition )
|
||||
{
|
||||
nHidden.style.top = iDivY+"px";
|
||||
|
@ -792,23 +792,23 @@ ColVis.prototype = {
|
|||
}
|
||||
nHidden.style.display = "block";
|
||||
$(nHidden).css('opacity',0);
|
||||
|
||||
|
||||
var iWinHeight = $(window).height(), iDocHeight = $(document).height(),
|
||||
iWinWidth = $(window).width(), iDocWidth = $(document).width();
|
||||
|
||||
|
||||
nBackground.style.height = ((iWinHeight>iDocHeight)? iWinHeight : iDocHeight) +"px";
|
||||
nBackground.style.width = ((iWinWidth<iDocWidth)? iWinWidth : iDocWidth) +"px";
|
||||
|
||||
|
||||
var oStyle = this.dom.catcher.style;
|
||||
oStyle.height = $(this.dom.button).outerHeight()+"px";
|
||||
oStyle.width = $(this.dom.button).outerWidth()+"px";
|
||||
oStyle.top = oPos.top+"px";
|
||||
oStyle.left = iDivX+"px";
|
||||
|
||||
|
||||
document.body.appendChild( nBackground );
|
||||
document.body.appendChild( nHidden );
|
||||
document.body.appendChild( this.dom.catcher );
|
||||
|
||||
|
||||
/* Resize the buttons */
|
||||
if ( this.s.sSize == "auto" )
|
||||
{
|
||||
|
@ -832,7 +832,7 @@ ColVis.prototype = {
|
|||
}
|
||||
this.dom.collection.style.width = iMax+"px";
|
||||
}
|
||||
|
||||
|
||||
/* Visual corrections to try and keep the collection visible */
|
||||
if ( !this.s.bCssPosition )
|
||||
{
|
||||
|
@ -841,13 +841,13 @@ ColVis.prototype = {
|
|||
|
||||
var iDivWidth = $(nHidden).outerWidth();
|
||||
var iDivHeight = $(nHidden).outerHeight();
|
||||
|
||||
|
||||
if ( iDivX + iDivWidth > iDocWidth )
|
||||
{
|
||||
nHidden.style.left = (iDocWidth-iDivWidth)+"px";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* This results in a very small delay for the end user but it allows the animation to be
|
||||
* much smoother. If you don't want the animation, then the setTimeout can be removed
|
||||
*/
|
||||
|
@ -863,37 +863,37 @@ ColVis.prototype = {
|
|||
}
|
||||
});
|
||||
}, 10 );
|
||||
|
||||
|
||||
this.s.hidden = false;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Hide the show / hide list and the background
|
||||
* @method _fnCollectionHide
|
||||
* @returns void
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnCollectionHide": function ( )
|
||||
{
|
||||
var that = this;
|
||||
|
||||
|
||||
if ( !this.s.hidden && this.dom.collection !== null )
|
||||
{
|
||||
this.s.hidden = true;
|
||||
|
||||
|
||||
$(this.dom.collection).animate({"opacity": 0}, that.s.iOverlayFade, function (e) {
|
||||
this.style.display = "none";
|
||||
} );
|
||||
|
||||
|
||||
$(this.dom.background).animate({"opacity": 0}, that.s.iOverlayFade, function (e) {
|
||||
document.body.removeChild( that.dom.background );
|
||||
document.body.removeChild( that.dom.catcher );
|
||||
} );
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Alter the colspan on any fnOpen rows
|
||||
*/
|
||||
|
@ -901,7 +901,7 @@ ColVis.prototype = {
|
|||
{
|
||||
var aoOpen = this.s.dt.aoOpenRows;
|
||||
var iVisible = this.s.dt.oApi._fnVisbleColumns( this.s.dt );
|
||||
|
||||
|
||||
for ( var i=0, iLen=aoOpen.length ; i<iLen ; i++ ) {
|
||||
aoOpen[i].nTr.getElementsByTagName('td')[0].colSpan = iVisible;
|
||||
}
|
||||
|
@ -930,7 +930,7 @@ ColVis.fnRebuild = function ( oTable )
|
|||
{
|
||||
nTable = oTable.fnSettings().nTable;
|
||||
}
|
||||
|
||||
|
||||
for ( var i=0, iLen=ColVis.aInstances.length ; i<iLen ; i++ )
|
||||
{
|
||||
if ( typeof oTable == 'undefined' || nTable == ColVis.aInstances[i].s.dt.nTable )
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
* License: GPL v2 or BSD 3 point style
|
||||
* Project: Just a little bit of fun :-)
|
||||
* Contact: www.sprymedia.co.uk/contact
|
||||
*
|
||||
*
|
||||
* Copyright 2010-2011 Allan Jardine, all rights reserved.
|
||||
*
|
||||
* This source file is free software, under either the GPL v2 license or a
|
||||
|
@ -21,7 +21,7 @@
|
|||
|
||||
(function($) {
|
||||
|
||||
/**
|
||||
/**
|
||||
* ColVis provides column visiblity control for DataTables
|
||||
* @class ColVis
|
||||
* @constructor
|
||||
|
@ -34,17 +34,17 @@ ColVis = function( oDTSettings, oInit )
|
|||
{
|
||||
alert( "Warning: ColVis must be initialised with the keyword 'new'" );
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oInit == 'undefined' )
|
||||
{
|
||||
oInit = {};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Public class variables
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
|
||||
/**
|
||||
* @namespace Settings object which contains customisable information for ColVis instance
|
||||
*/
|
||||
|
@ -56,7 +56,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default null
|
||||
*/
|
||||
"dt": null,
|
||||
|
||||
|
||||
/**
|
||||
* Customisation object
|
||||
* @property oInit
|
||||
|
@ -64,7 +64,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default passed in
|
||||
*/
|
||||
"oInit": oInit,
|
||||
|
||||
|
||||
/**
|
||||
* Callback function to tell the user when the state has changed
|
||||
* @property fnStateChange
|
||||
|
@ -72,7 +72,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default null
|
||||
*/
|
||||
"fnStateChange": null,
|
||||
|
||||
|
||||
/**
|
||||
* Mode of activation. Can be 'click' or 'mouseover'
|
||||
* @property activate
|
||||
|
@ -80,7 +80,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default click
|
||||
*/
|
||||
"activate": "click",
|
||||
|
||||
|
||||
/**
|
||||
* Position of the collection menu when shown - align "left" or "right"
|
||||
* @property sAlign
|
||||
|
@ -88,7 +88,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default right
|
||||
*/
|
||||
"sAlign": "left",
|
||||
|
||||
|
||||
/**
|
||||
* Text used for the button
|
||||
* @property buttonText
|
||||
|
@ -96,7 +96,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default Show / hide columns
|
||||
*/
|
||||
"buttonText": "Show / hide columns",
|
||||
|
||||
|
||||
/**
|
||||
* Flag to say if the collection is hidden
|
||||
* @property hidden
|
||||
|
@ -104,7 +104,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default true
|
||||
*/
|
||||
"hidden": true,
|
||||
|
||||
|
||||
/**
|
||||
* List of columns (integers) which should be excluded from the list
|
||||
* @property aiExclude
|
||||
|
@ -112,7 +112,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default []
|
||||
*/
|
||||
"aiExclude": [],
|
||||
|
||||
|
||||
/**
|
||||
* Store the original viisbility settings so they could be restored
|
||||
* @property abOriginal
|
||||
|
@ -120,7 +120,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default []
|
||||
*/
|
||||
"abOriginal": [],
|
||||
|
||||
|
||||
/**
|
||||
* Show Show-All button
|
||||
* @property bShowAll
|
||||
|
@ -128,7 +128,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default []
|
||||
*/
|
||||
"bShowAll": false,
|
||||
|
||||
|
||||
/**
|
||||
* Show All button text
|
||||
* @property sShowAll
|
||||
|
@ -136,7 +136,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default Restore original
|
||||
*/
|
||||
"sShowAll": "Show All",
|
||||
|
||||
|
||||
/**
|
||||
* Show restore button
|
||||
* @property bRestore
|
||||
|
@ -144,7 +144,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default []
|
||||
*/
|
||||
"bRestore": false,
|
||||
|
||||
|
||||
/**
|
||||
* Restore button text
|
||||
* @property sRestore
|
||||
|
@ -152,7 +152,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default Restore original
|
||||
*/
|
||||
"sRestore": "Restore original",
|
||||
|
||||
|
||||
/**
|
||||
* Overlay animation duration in mS
|
||||
* @property iOverlayFade
|
||||
|
@ -160,7 +160,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default 500
|
||||
*/
|
||||
"iOverlayFade": 500,
|
||||
|
||||
|
||||
/**
|
||||
* Label callback for column names. Takes three parameters: 1. the column index, 2. the column
|
||||
* title detected by DataTables and 3. the TH node for the column
|
||||
|
@ -169,7 +169,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default null
|
||||
*/
|
||||
"fnLabel": null,
|
||||
|
||||
|
||||
/**
|
||||
* Indicate if ColVis should automatically calculate the size of buttons or not. The default
|
||||
* is for it to do so. Set to "css" to disable the automatic sizing
|
||||
|
@ -178,7 +178,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default auto
|
||||
*/
|
||||
"sSize": "auto",
|
||||
|
||||
|
||||
/**
|
||||
* Indicate if the column list should be positioned by Javascript, visually below the button
|
||||
* or allow CSS to do the positioning
|
||||
|
@ -188,8 +188,8 @@ ColVis = function( oDTSettings, oInit )
|
|||
*/
|
||||
"bCssPosition": false
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @namespace Common and useful DOM elements for the class instance
|
||||
*/
|
||||
|
@ -201,7 +201,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default null
|
||||
*/
|
||||
"wrapper": null,
|
||||
|
||||
|
||||
/**
|
||||
* Activation button
|
||||
* @property button
|
||||
|
@ -209,7 +209,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default null
|
||||
*/
|
||||
"button": null,
|
||||
|
||||
|
||||
/**
|
||||
* Collection list node
|
||||
* @property collection
|
||||
|
@ -217,7 +217,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default null
|
||||
*/
|
||||
"collection": null,
|
||||
|
||||
|
||||
/**
|
||||
* Background node used for shading the display and event capturing
|
||||
* @property background
|
||||
|
@ -225,7 +225,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default null
|
||||
*/
|
||||
"background": null,
|
||||
|
||||
|
||||
/**
|
||||
* Element to position over the activation button to catch mouse events when using mouseover
|
||||
* @property catcher
|
||||
|
@ -233,7 +233,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default null
|
||||
*/
|
||||
"catcher": null,
|
||||
|
||||
|
||||
/**
|
||||
* List of button elements
|
||||
* @property buttons
|
||||
|
@ -241,7 +241,7 @@ ColVis = function( oDTSettings, oInit )
|
|||
* @default []
|
||||
*/
|
||||
"buttons": [],
|
||||
|
||||
|
||||
/**
|
||||
* Restore button
|
||||
* @property restore
|
||||
|
@ -250,10 +250,10 @@ ColVis = function( oDTSettings, oInit )
|
|||
*/
|
||||
"restore": null
|
||||
};
|
||||
|
||||
|
||||
/* Store global reference */
|
||||
ColVis.aInstances.push( this );
|
||||
|
||||
|
||||
/* Constructor logic */
|
||||
this.s.dt = oDTSettings;
|
||||
this._fnConstruct();
|
||||
|
@ -266,7 +266,7 @@ ColVis.prototype = {
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Public methods
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
|
||||
/**
|
||||
* Rebuild the list of buttons for this instance (i.e. if there is a column header update)
|
||||
* @method fnRebuild
|
||||
|
@ -283,55 +283,55 @@ ColVis.prototype = {
|
|||
}
|
||||
}
|
||||
this.dom.buttons.splice( 0, this.dom.buttons.length );
|
||||
|
||||
|
||||
if ( this.dom.restore )
|
||||
{
|
||||
this.dom.restore.parentNode( this.dom.restore );
|
||||
}
|
||||
|
||||
|
||||
/* Re-add them (this is not the optimal way of doing this, it is fast and effective) */
|
||||
this._fnAddButtons();
|
||||
|
||||
|
||||
/* Update the checkboxes */
|
||||
this._fnDrawCallback();
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Private methods (they are of course public in JS, but recommended as private)
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
|
||||
/**
|
||||
* Constructor logic
|
||||
* @method _fnConstruct
|
||||
* @returns void
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnConstruct": function ()
|
||||
{
|
||||
this._fnApplyCustomisation();
|
||||
|
||||
|
||||
var that = this;
|
||||
this.dom.wrapper = document.createElement('div');
|
||||
this.dom.wrapper.className = "ColVis TableTools";
|
||||
|
||||
|
||||
this.dom.button = this._fnDomBaseButton( this.s.buttonText );
|
||||
this.dom.button.className += " ColVis_MasterButton";
|
||||
this.dom.wrapper.appendChild( this.dom.button );
|
||||
|
||||
|
||||
this.dom.catcher = this._fnDomCatcher();
|
||||
this.dom.collection = this._fnDomCollection();
|
||||
this.dom.background = this._fnDomBackground();
|
||||
|
||||
|
||||
this._fnAddButtons();
|
||||
|
||||
|
||||
/* Store the original visbility information */
|
||||
for ( var i=0, iLen=this.s.dt.aoColumns.length ; i<iLen ; i++ )
|
||||
{
|
||||
this.s.abOriginal.push( this.s.dt.aoColumns[i].bVisible );
|
||||
}
|
||||
|
||||
|
||||
/* Update on each draw */
|
||||
this.s.dt.aoDrawCallback.push( {
|
||||
"fn": function () {
|
||||
|
@ -340,73 +340,73 @@ ColVis.prototype = {
|
|||
"sName": "ColVis"
|
||||
} );
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Apply any customisation to the settings from the DataTables initialisation
|
||||
* @method _fnApplyCustomisation
|
||||
* @returns void
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnApplyCustomisation": function ()
|
||||
{
|
||||
var oConfig = this.s.oInit;
|
||||
|
||||
|
||||
if ( typeof oConfig.activate != 'undefined' )
|
||||
{
|
||||
this.s.activate = oConfig.activate;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oConfig.buttonText != 'undefined' )
|
||||
{
|
||||
this.s.buttonText = oConfig.buttonText;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oConfig.aiExclude != 'undefined' )
|
||||
{
|
||||
this.s.aiExclude = oConfig.aiExclude;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oConfig.bRestore != 'undefined' )
|
||||
{
|
||||
this.s.bRestore = oConfig.bRestore;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oConfig.sRestore != 'undefined' )
|
||||
{
|
||||
this.s.sRestore = oConfig.sRestore;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oConfig.bShowAll != 'undefined' )
|
||||
{
|
||||
this.s.bShowAll = oConfig.bShowAll;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oConfig.sShowAll != 'undefined' )
|
||||
{
|
||||
this.s.sShowAll = oConfig.sShowAll;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oConfig.sAlign != 'undefined' )
|
||||
{
|
||||
this.s.sAlign = oConfig.sAlign;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oConfig.fnStateChange != 'undefined' )
|
||||
{
|
||||
this.s.fnStateChange = oConfig.fnStateChange;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oConfig.iOverlayFade != 'undefined' )
|
||||
{
|
||||
this.s.iOverlayFade = oConfig.iOverlayFade;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oConfig.fnLabel != 'undefined' )
|
||||
{
|
||||
this.s.fnLabel = oConfig.fnLabel;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oConfig.sSize != 'undefined' )
|
||||
{
|
||||
this.s.sSize = oConfig.sSize;
|
||||
|
@ -417,19 +417,19 @@ ColVis.prototype = {
|
|||
this.s.bCssPosition = oConfig.bCssPosition;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* On each table draw, check the visiblity checkboxes as needed. This allows any process to
|
||||
* update the table's column visiblity and ColVis will still be accurate.
|
||||
* @method _fnDrawCallback
|
||||
* @returns void
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnDrawCallback": function ()
|
||||
{
|
||||
var aoColumns = this.s.dt.aoColumns;
|
||||
|
||||
|
||||
for ( var i=0, iLen=aoColumns.length ; i<iLen ; i++ )
|
||||
{
|
||||
if ( this.dom.buttons[i] !== null )
|
||||
|
@ -445,20 +445,20 @@ ColVis.prototype = {
|
|||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Loop through the columns in the table and as a new button for each one.
|
||||
* @method _fnAddButtons
|
||||
* @returns void
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnAddButtons": function ()
|
||||
{
|
||||
var
|
||||
nButton,
|
||||
sExclude = ","+this.s.aiExclude.join(',')+",";
|
||||
|
||||
|
||||
for ( var i=0, iLen=this.s.dt.aoColumns.length ; i<iLen ; i++ )
|
||||
{
|
||||
if ( sExclude.indexOf( ","+i+"," ) == -1 )
|
||||
|
@ -472,7 +472,7 @@ ColVis.prototype = {
|
|||
this.dom.buttons.push( null );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( this.s.bRestore )
|
||||
{
|
||||
nButton = this._fnDomRestoreButton();
|
||||
|
@ -480,7 +480,7 @@ ColVis.prototype = {
|
|||
this.dom.buttons.push( nButton );
|
||||
this.dom.collection.appendChild( nButton );
|
||||
}
|
||||
|
||||
|
||||
if ( this.s.bShowAll )
|
||||
{
|
||||
nButton = this._fnDomShowAllButton();
|
||||
|
@ -489,13 +489,13 @@ ColVis.prototype = {
|
|||
this.dom.collection.appendChild( nButton );
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create a button which allows a "restore" action
|
||||
* @method _fnDomRestoreButton
|
||||
* @returns {Node} Created button
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnDomRestoreButton": function ()
|
||||
{
|
||||
|
@ -503,12 +503,12 @@ ColVis.prototype = {
|
|||
that = this,
|
||||
nButton = document.createElement('button'),
|
||||
nSpan = document.createElement('span');
|
||||
|
||||
|
||||
nButton.className = !this.s.dt.bJUI ? "ColVis_Button TableTools_Button" :
|
||||
"ColVis_Button TableTools_Button ui-button ui-state-default";
|
||||
nButton.appendChild( nSpan );
|
||||
$(nSpan).html( '<span class="ColVis_title">'+this.s.sRestore+'</span>' );
|
||||
|
||||
|
||||
$(nButton).click( function (e) {
|
||||
for ( var i=0, iLen=that.s.abOriginal.length ; i<iLen ; i++ )
|
||||
{
|
||||
|
@ -517,16 +517,16 @@ ColVis.prototype = {
|
|||
that._fnAdjustOpenRows();
|
||||
that.s.dt.oInstance.fnDraw( false );
|
||||
} );
|
||||
|
||||
|
||||
return nButton;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create a button which allows a "show all" action
|
||||
* @method _fnDomShowAllButton
|
||||
* @returns {Node} Created button
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnDomShowAllButton": function ()
|
||||
{
|
||||
|
@ -534,12 +534,12 @@ ColVis.prototype = {
|
|||
that = this,
|
||||
nButton = document.createElement('button'),
|
||||
nSpan = document.createElement('span');
|
||||
|
||||
|
||||
nButton.className = !this.s.dt.bJUI ? "ColVis_Button TableTools_Button" :
|
||||
"ColVis_Button TableTools_Button ui-button ui-state-default";
|
||||
nButton.appendChild( nSpan );
|
||||
$(nSpan).html( '<span class="ColVis_title">'+this.s.sShowAll+'</span>' );
|
||||
|
||||
|
||||
$(nButton).click( function (e) {
|
||||
for ( var i=0, iLen=that.s.abOriginal.length ; i<iLen ; i++ )
|
||||
{
|
||||
|
@ -551,17 +551,17 @@ ColVis.prototype = {
|
|||
that._fnAdjustOpenRows();
|
||||
that.s.dt.oInstance.fnDraw( false );
|
||||
} );
|
||||
|
||||
|
||||
return nButton;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create the DOM for a show / hide button
|
||||
* @method _fnDomColumnButton
|
||||
* @param {int} i Column in question
|
||||
* @returns {Node} Created button
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnDomColumnButton": function ( i )
|
||||
{
|
||||
|
@ -571,7 +571,7 @@ ColVis.prototype = {
|
|||
nButton = document.createElement('button'),
|
||||
nSpan = document.createElement('span'),
|
||||
dt = this.s.dt;
|
||||
|
||||
|
||||
nButton.className = !dt.bJUI ? "ColVis_Button TableTools_Button" :
|
||||
"ColVis_Button TableTools_Button ui-button ui-state-default";
|
||||
nButton.appendChild( nSpan );
|
||||
|
@ -579,14 +579,14 @@ ColVis.prototype = {
|
|||
$(nSpan).html(
|
||||
'<span class="ColVis_radio"><input type="checkbox"/></span>'+
|
||||
'<span class="ColVis_title">'+sTitle+'</span>' );
|
||||
|
||||
|
||||
$(nButton).click( function (e) {
|
||||
var showHide = !$('input', this).is(":checked");
|
||||
if ( e.target.nodeName.toLowerCase() == "input" )
|
||||
{
|
||||
showHide = $('input', this).is(":checked");
|
||||
}
|
||||
|
||||
|
||||
/* Need to consider the case where the initialiser created more than one table - change the
|
||||
* API index that DataTables is using
|
||||
*/
|
||||
|
@ -606,22 +606,22 @@ ColVis.prototype = {
|
|||
}
|
||||
|
||||
$.fn.dataTableExt.iApiIndex = oldIndex; /* Restore */
|
||||
|
||||
|
||||
if ( that.s.fnStateChange !== null )
|
||||
{
|
||||
that.s.fnStateChange.call( that, i, showHide );
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
return nButton;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the position in the DataTables instance array of the table for this instance of ColVis
|
||||
* @method _fnDataTablesApiIndex
|
||||
* @returns {int} Index
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnDataTablesApiIndex": function ()
|
||||
{
|
||||
|
@ -634,14 +634,14 @@ ColVis.prototype = {
|
|||
}
|
||||
return 0;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create the DOM needed for the button and apply some base properties. All buttons start here
|
||||
* @method _fnDomBaseButton
|
||||
* @param {String} text Button text
|
||||
* @returns {Node} DIV element for the button
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnDomBaseButton": function ( text )
|
||||
{
|
||||
|
@ -650,26 +650,26 @@ ColVis.prototype = {
|
|||
nButton = document.createElement('button'),
|
||||
nSpan = document.createElement('span'),
|
||||
sEvent = this.s.activate=="mouseover" ? "mouseover" : "click";
|
||||
|
||||
|
||||
nButton.className = !this.s.dt.bJUI ? "ColVis_Button TableTools_Button" :
|
||||
"ColVis_Button TableTools_Button ui-button ui-state-default";
|
||||
nButton.appendChild( nSpan );
|
||||
nSpan.innerHTML = text;
|
||||
|
||||
|
||||
$(nButton).bind( sEvent, function (e) {
|
||||
that._fnCollectionShow();
|
||||
e.preventDefault();
|
||||
} );
|
||||
|
||||
|
||||
return nButton;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create the element used to contain list the columns (it is shown and hidden as needed)
|
||||
* @method _fnDomCollection
|
||||
* @returns {Node} div container for the collection
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnDomCollection": function ()
|
||||
{
|
||||
|
@ -678,60 +678,60 @@ ColVis.prototype = {
|
|||
nHidden.style.display = "none";
|
||||
nHidden.className = !this.s.dt.bJUI ? "ColVis_collection TableTools_collection" :
|
||||
"ColVis_collection TableTools_collection ui-buttonset ui-buttonset-multi";
|
||||
|
||||
|
||||
if ( !this.s.bCssPosition )
|
||||
{
|
||||
nHidden.style.position = "absolute";
|
||||
}
|
||||
$(nHidden).css('opacity', 0);
|
||||
|
||||
|
||||
return nHidden;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* An element to be placed on top of the activate button to catch events
|
||||
* @method _fnDomCatcher
|
||||
* @returns {Node} div container for the collection
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnDomCatcher": function ()
|
||||
{
|
||||
var
|
||||
var
|
||||
that = this,
|
||||
nCatcher = document.createElement('div');
|
||||
nCatcher.className = "ColVis_catcher TableTools_catcher";
|
||||
|
||||
|
||||
$(nCatcher).click( function () {
|
||||
that._fnCollectionHide.call( that, null, null );
|
||||
} );
|
||||
|
||||
|
||||
return nCatcher;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create the element used to shade the background, and capture hide events (it is shown and
|
||||
* Create the element used to shade the background, and capture hide events (it is shown and
|
||||
* hidden as needed)
|
||||
* @method _fnDomBackground
|
||||
* @returns {Node} div container for the background
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnDomBackground": function ()
|
||||
{
|
||||
var that = this;
|
||||
|
||||
|
||||
var nBackground = document.createElement('div');
|
||||
nBackground.style.position = "absolute";
|
||||
nBackground.style.left = "0px";
|
||||
nBackground.style.top = "0px";
|
||||
nBackground.className = "ColVis_collectionBackground TableTools_collectionBackground";
|
||||
$(nBackground).css('opacity', 0);
|
||||
|
||||
|
||||
$(nBackground).click( function () {
|
||||
that._fnCollectionHide.call( that, null, null );
|
||||
} );
|
||||
|
||||
|
||||
/* When considering a mouse over action for the activation, we also consider a mouse out
|
||||
* which is the same as a mouse over the background - without all the messing around of
|
||||
* bubbling events. Use the catcher element to avoid messing around with bubbling
|
||||
|
@ -743,16 +743,16 @@ ColVis.prototype = {
|
|||
that._fnCollectionHide.call( that, null, null );
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
return nBackground;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Show the show / hide list and the background
|
||||
* @method _fnCollectionShow
|
||||
* @returns void
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnCollectionShow": function ()
|
||||
{
|
||||
|
@ -762,7 +762,7 @@ ColVis.prototype = {
|
|||
var nBackground = this.dom.background;
|
||||
var iDivX = parseInt(oPos.left, 10);
|
||||
var iDivY = parseInt(oPos.top + $(this.dom.button).outerHeight(), 10);
|
||||
|
||||
|
||||
if ( !this.s.bCssPosition )
|
||||
{
|
||||
nHidden.style.top = iDivY+"px";
|
||||
|
@ -770,23 +770,23 @@ ColVis.prototype = {
|
|||
}
|
||||
nHidden.style.display = "block";
|
||||
$(nHidden).css('opacity',0);
|
||||
|
||||
|
||||
var iWinHeight = $(window).height(), iDocHeight = $(document).height(),
|
||||
iWinWidth = $(window).width(), iDocWidth = $(document).width();
|
||||
|
||||
|
||||
nBackground.style.height = ((iWinHeight>iDocHeight)? iWinHeight : iDocHeight) +"px";
|
||||
nBackground.style.width = ((iWinWidth<iDocWidth)? iWinWidth : iDocWidth) +"px";
|
||||
|
||||
|
||||
var oStyle = this.dom.catcher.style;
|
||||
oStyle.height = $(this.dom.button).outerHeight()+"px";
|
||||
oStyle.width = $(this.dom.button).outerWidth()+"px";
|
||||
oStyle.top = oPos.top+"px";
|
||||
oStyle.left = iDivX+"px";
|
||||
|
||||
|
||||
document.body.appendChild( nBackground );
|
||||
document.body.appendChild( nHidden );
|
||||
document.body.appendChild( this.dom.catcher );
|
||||
|
||||
|
||||
/* Resize the buttons */
|
||||
if ( this.s.sSize == "auto" )
|
||||
{
|
||||
|
@ -810,7 +810,7 @@ ColVis.prototype = {
|
|||
}
|
||||
this.dom.collection.style.width = iMax+"px";
|
||||
}
|
||||
|
||||
|
||||
/* Visual corrections to try and keep the collection visible */
|
||||
if ( !this.s.bCssPosition )
|
||||
{
|
||||
|
@ -819,13 +819,13 @@ ColVis.prototype = {
|
|||
|
||||
var iDivWidth = $(nHidden).outerWidth();
|
||||
var iDivHeight = $(nHidden).outerHeight();
|
||||
|
||||
|
||||
if ( iDivX + iDivWidth > iDocWidth )
|
||||
{
|
||||
nHidden.style.left = (iDocWidth-iDivWidth)+"px";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* This results in a very small delay for the end user but it allows the animation to be
|
||||
* much smoother. If you don't want the animation, then the setTimeout can be removed
|
||||
*/
|
||||
|
@ -841,37 +841,37 @@ ColVis.prototype = {
|
|||
}
|
||||
});
|
||||
}, 10 );
|
||||
|
||||
|
||||
this.s.hidden = false;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Hide the show / hide list and the background
|
||||
* @method _fnCollectionHide
|
||||
* @returns void
|
||||
* @private
|
||||
* @private
|
||||
*/
|
||||
"_fnCollectionHide": function ( )
|
||||
{
|
||||
var that = this;
|
||||
|
||||
|
||||
if ( !this.s.hidden && this.dom.collection !== null )
|
||||
{
|
||||
this.s.hidden = true;
|
||||
|
||||
|
||||
$(this.dom.collection).animate({"opacity": 0}, that.s.iOverlayFade, function (e) {
|
||||
this.style.display = "none";
|
||||
} );
|
||||
|
||||
|
||||
$(this.dom.background).animate({"opacity": 0}, that.s.iOverlayFade, function (e) {
|
||||
document.body.removeChild( that.dom.background );
|
||||
document.body.removeChild( that.dom.catcher );
|
||||
} );
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Alter the colspan on any fnOpen rows
|
||||
*/
|
||||
|
@ -879,7 +879,7 @@ ColVis.prototype = {
|
|||
{
|
||||
var aoOpen = this.s.dt.aoOpenRows;
|
||||
var iVisible = this.s.dt.oApi._fnVisbleColumns( this.s.dt );
|
||||
|
||||
|
||||
for ( var i=0, iLen=aoOpen.length ; i<iLen ; i++ ) {
|
||||
aoOpen[i].nTr.getElementsByTagName('td')[0].colSpan = iVisible;
|
||||
}
|
||||
|
@ -908,7 +908,7 @@ ColVis.fnRebuild = function ( oTable )
|
|||
{
|
||||
nTable = oTable.fnSettings().nTable;
|
||||
}
|
||||
|
||||
|
||||
for ( var i=0, iLen=ColVis.aInstances.length ; i<iLen ; i++ )
|
||||
{
|
||||
if ( typeof oTable == 'undefined' || nTable == ColVis.aInstances[i].s.dt.nTable )
|
||||
|
|
|
@ -22,11 +22,11 @@ var FixedColumns;
|
|||
(function($, window, document) {
|
||||
|
||||
|
||||
/**
|
||||
* When making use of DataTables' x-axis scrolling feature, you may wish to
|
||||
* fix the left most column in place. This plug-in for DataTables provides
|
||||
* exactly this option (note for non-scrolling tables, please use the
|
||||
* FixedHeader plug-in, which can fix headers, footers and columns). Key
|
||||
/**
|
||||
* When making use of DataTables' x-axis scrolling feature, you may wish to
|
||||
* fix the left most column in place. This plug-in for DataTables provides
|
||||
* exactly this option (note for non-scrolling tables, please use the
|
||||
* FixedHeader plug-in, which can fix headers, footers and columns). Key
|
||||
* features include:
|
||||
* <ul class="limit_length">
|
||||
* <li>Freezes the left or right most columns to the side of the table</li>
|
||||
|
@ -39,10 +39,10 @@ var FixedColumns;
|
|||
* @constructor
|
||||
* @param {object} oDT DataTables instance
|
||||
* @param {object} [oInit={}] Configuration object for FixedColumns. Options are defined by {@link FixedColumns.defaults}
|
||||
*
|
||||
*
|
||||
* @requires jQuery 1.3+
|
||||
* @requires DataTables 1.8.0.dev+
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* var oTable = $('#example').dataTable( {
|
||||
* "sScrollX": "100%"
|
||||
|
@ -56,40 +56,40 @@ FixedColumns = function ( oDT, oInit ) {
|
|||
alert( "FixedColumns warning: FixedColumns must be initialised with the 'new' keyword." );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oInit == 'undefined' )
|
||||
{
|
||||
oInit = {};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Settings object which contains customisable information for FixedColumns instance
|
||||
* @namespace
|
||||
* @extends FixedColumns.defaults
|
||||
*/
|
||||
this.s = {
|
||||
/**
|
||||
/**
|
||||
* DataTables settings objects
|
||||
* @type object
|
||||
* @default Obtained from DataTables instance
|
||||
*/
|
||||
"dt": oDT.fnSettings(),
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Number of columns in the DataTable - stored for quick access
|
||||
* @type int
|
||||
* @default Obtained from DataTables instance
|
||||
*/
|
||||
"iTableColumns": oDT.fnSettings().aoColumns.length,
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Original widths of the columns as rendered by DataTables
|
||||
* @type array.<int>
|
||||
* @default []
|
||||
*/
|
||||
"aiWidths": [],
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Flag to indicate if we are dealing with IE6/7 as these browsers need a little hack
|
||||
* in the odd place
|
||||
* @type boolean
|
||||
|
@ -98,12 +98,12 @@ FixedColumns = function ( oDT, oInit ) {
|
|||
*/
|
||||
"bOldIE": ($.browser.msie && ($.browser.version == "6.0" || $.browser.version == "7.0"))
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* DOM elements used by the class instance
|
||||
* @namespace
|
||||
*
|
||||
*
|
||||
*/
|
||||
this.dom = {
|
||||
/**
|
||||
|
@ -112,21 +112,21 @@ FixedColumns = function ( oDT, oInit ) {
|
|||
* @default null
|
||||
*/
|
||||
"scroller": null,
|
||||
|
||||
|
||||
/**
|
||||
* DataTables header table
|
||||
* @type node
|
||||
* @default null
|
||||
*/
|
||||
"header": null,
|
||||
|
||||
|
||||
/**
|
||||
* DataTables body table
|
||||
* @type node
|
||||
* @default null
|
||||
*/
|
||||
"body": null,
|
||||
|
||||
|
||||
/**
|
||||
* DataTables footer table
|
||||
* @type node
|
||||
|
@ -177,7 +177,7 @@ FixedColumns = function ( oDT, oInit ) {
|
|||
"foot": null
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Cloned table nodes
|
||||
* @namespace
|
||||
|
@ -194,14 +194,14 @@ FixedColumns = function ( oDT, oInit ) {
|
|||
* @default null
|
||||
*/
|
||||
"header": null,
|
||||
|
||||
|
||||
/**
|
||||
* Cloned body table
|
||||
* @type node
|
||||
* @default null
|
||||
*/
|
||||
"body": null,
|
||||
|
||||
|
||||
/**
|
||||
* Cloned footer table
|
||||
* @type node
|
||||
|
@ -209,7 +209,7 @@ FixedColumns = function ( oDT, oInit ) {
|
|||
*/
|
||||
"footer": null
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Right column cloned table nodes
|
||||
* @namespace
|
||||
|
@ -221,14 +221,14 @@ FixedColumns = function ( oDT, oInit ) {
|
|||
* @default null
|
||||
*/
|
||||
"header": null,
|
||||
|
||||
|
||||
/**
|
||||
* Cloned body table
|
||||
* @type node
|
||||
* @default null
|
||||
*/
|
||||
"body": null,
|
||||
|
||||
|
||||
/**
|
||||
* Cloned footer table
|
||||
* @type node
|
||||
|
@ -241,7 +241,7 @@ FixedColumns = function ( oDT, oInit ) {
|
|||
|
||||
/* Attach the instance to the DataTables instance so it can be accessed easily */
|
||||
this.s.dt.oFixedColumns = this;
|
||||
|
||||
|
||||
/* Let's do it */
|
||||
this._fnConstruct( oInit );
|
||||
};
|
||||
|
@ -252,7 +252,7 @@ FixedColumns.prototype = {
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Public methods
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
|
||||
/**
|
||||
* Update the fixed columns - including headers and footers. Note that FixedColumns will
|
||||
* automatically update the display whenever the host DataTable redraws.
|
||||
|
@ -262,7 +262,7 @@ FixedColumns.prototype = {
|
|||
* "sScrollX": "100%"
|
||||
* } );
|
||||
* var oFC = new FixedColumns( oTable );
|
||||
*
|
||||
*
|
||||
* // at some later point when the table has been manipulated....
|
||||
* oFC.fnUpdate();
|
||||
*/
|
||||
|
@ -270,8 +270,8 @@ FixedColumns.prototype = {
|
|||
{
|
||||
this._fnDraw( true );
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Recalculate the resizes of the 3x3 grid that FixedColumns uses for display of the table.
|
||||
* This is useful if you update the width of the table container. Note that FixedColumns will
|
||||
|
@ -282,7 +282,7 @@ FixedColumns.prototype = {
|
|||
* "sScrollX": "100%"
|
||||
* } );
|
||||
* var oFC = new FixedColumns( oTable );
|
||||
*
|
||||
*
|
||||
* // Resize the table container and then have FixedColumns adjust its layout....
|
||||
* $('#content').width( 1200 );
|
||||
* oFC.fnRedrawLayout();
|
||||
|
@ -291,8 +291,8 @@ FixedColumns.prototype = {
|
|||
{
|
||||
this.__fnGridLayout();
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Mark a row such that it's height should be recalculated when using 'semiauto' row
|
||||
* height matching. This function will have no effect when 'none' or 'auto' row height
|
||||
|
@ -304,7 +304,7 @@ FixedColumns.prototype = {
|
|||
* "sScrollX": "100%"
|
||||
* } );
|
||||
* var oFC = new FixedColumns( oTable );
|
||||
*
|
||||
*
|
||||
* // manipulate the table - mark the row as needing an update then update the table
|
||||
* // this allows the redraw performed by DataTables fnUpdate to recalculate the row
|
||||
* // height
|
||||
|
@ -316,8 +316,8 @@ FixedColumns.prototype = {
|
|||
nTr._DTTC_iHeight = null;
|
||||
nTr.style.height = 'auto';
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set the height of a given row - provides cross browser compatibility
|
||||
* @param {Node} nTarget TR element that should have it's height recalculated
|
||||
|
@ -328,7 +328,7 @@ FixedColumns.prototype = {
|
|||
* "sScrollX": "100%"
|
||||
* } );
|
||||
* var oFC = new FixedColumns( oTable );
|
||||
*
|
||||
*
|
||||
* // You may want to do this after manipulating a row in the fixed column
|
||||
* oFC.fnSetRowHeight( $('#example tbody tr:eq(0)')[0], 50 );
|
||||
*/
|
||||
|
@ -347,13 +347,13 @@ FixedColumns.prototype = {
|
|||
$(nTarget).children().height( iHeight-iBoxHack );
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Private methods (they are of course public in JS, but recommended as private)
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
|
||||
/**
|
||||
* Initialisation for FixedColumns
|
||||
* @param {Object} oInit User settings for initialisation
|
||||
|
@ -364,7 +364,7 @@ FixedColumns.prototype = {
|
|||
{
|
||||
var i, iLen, iWidth,
|
||||
that = this;
|
||||
|
||||
|
||||
/* Sanity checking */
|
||||
if ( typeof this.s.dt.oInstance.fnVersionCheck != 'function' ||
|
||||
this.s.dt.oInstance.fnVersionCheck( '1.8.0' ) !== true )
|
||||
|
@ -373,7 +373,7 @@ FixedColumns.prototype = {
|
|||
"Please upgrade your DataTables installation" );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ( this.s.dt.oScroll.sX === "" )
|
||||
{
|
||||
this.s.dt.oInstance.oApi._fnLog( this.s.dt, 1, "FixedColumns is not needed (no "+
|
||||
|
@ -381,7 +381,7 @@ FixedColumns.prototype = {
|
|||
"column fixing when scrolling is not enabled" );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* Apply the settings from the user / defaults */
|
||||
this.s = $.extend( true, this.s, FixedColumns.defaults, oInit );
|
||||
|
||||
|
@ -409,15 +409,15 @@ FixedColumns.prototype = {
|
|||
if ( this.s.iLeftWidth === null )
|
||||
{
|
||||
this.s.iLeftWidth = this.s.sLeftWidth == 'fixed' ?
|
||||
iLeftWidth : (iLeftWidth/iScrollWidth) * 100;
|
||||
iLeftWidth : (iLeftWidth/iScrollWidth) * 100;
|
||||
}
|
||||
|
||||
|
||||
if ( this.s.iRightWidth === null )
|
||||
{
|
||||
this.s.iRightWidth = this.s.sRightWidth == 'fixed' ?
|
||||
iRightWidth : (iRightWidth/iScrollWidth) * 100;
|
||||
}
|
||||
|
||||
|
||||
/* Set up the DOM that we want for the fixed column layout grid */
|
||||
this._fnGridSetup();
|
||||
|
||||
|
@ -443,7 +443,7 @@ FixedColumns.prototype = {
|
|||
$(window).resize( function () {
|
||||
that._fnGridLayout.call( that );
|
||||
} );
|
||||
|
||||
|
||||
var bFirstDraw = true;
|
||||
this.s.dt.aoDrawCallback = [ {
|
||||
"fn": function () {
|
||||
|
@ -453,7 +453,7 @@ FixedColumns.prototype = {
|
|||
},
|
||||
"sName": "FixedColumns"
|
||||
} ].concat( this.s.dt.aoDrawCallback );
|
||||
|
||||
|
||||
/* Get things right to start with - note that due to adjusting the columns, there must be
|
||||
* another redraw of the main table. It doesn't need to be a full redraw however.
|
||||
*/
|
||||
|
@ -461,8 +461,8 @@ FixedColumns.prototype = {
|
|||
this._fnGridHeight();
|
||||
this.s.dt.oInstance.fnDraw(false);
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set up the DOM for the fixed column. The way the layout works is to create a 1x3 grid
|
||||
* for the left column, the DataTable (for which we just reuse the scrolling element DataTable
|
||||
|
@ -479,8 +479,8 @@ FixedColumns.prototype = {
|
|||
this.dom.body = this.s.dt.nTable;
|
||||
this.dom.header = this.s.dt.nTHead.parentNode;
|
||||
this.dom.header.parentNode.parentNode.style.position = "relative";
|
||||
|
||||
var nSWrapper =
|
||||
|
||||
var nSWrapper =
|
||||
$('<div class="DTFC_ScrollWrapper" style="position:relative; clear:both;">'+
|
||||
'<div class="DTFC_LeftWrapper" style="position:absolute; top:0; left:0;">'+
|
||||
'<div class="DTFC_LeftHeadWrapper" style="position:relative; top:0; left:0; overflow:hidden;"></div>'+
|
||||
|
@ -507,7 +507,7 @@ FixedColumns.prototype = {
|
|||
this.dom.grid.right.head = nRight.childNodes[0];
|
||||
this.dom.grid.right.body = nRight.childNodes[1];
|
||||
}
|
||||
|
||||
|
||||
if ( this.s.dt.nTFoot )
|
||||
{
|
||||
this.dom.footer = this.s.dt.nTFoot.parentNode;
|
||||
|
@ -527,8 +527,8 @@ FixedColumns.prototype = {
|
|||
this.dom.grid.dt.style.left = this.s.iLeftWidth+"px";
|
||||
this.dom.grid.dt.style.width = ($(this.dom.grid.dt).width()-this.s.iLeftWidth-this.s.iRightWidth)+"px";
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Style and position the grid used for the FixedColumns layout based on the instance settings.
|
||||
* Specifically sLeftWidth ('fixed' or 'absolute'), iLeftWidth (px if fixed, % if absolute) and
|
||||
|
@ -572,10 +572,10 @@ FixedColumns.prototype = {
|
|||
oGrid.right.wrapper.style.left = (iTotal-iRight)+"px";
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Recalculate and set the height of the grid components used for positioning of the
|
||||
* Recalculate and set the height of the grid components used for positioning of the
|
||||
* FixedColumn display grid.
|
||||
* @returns {void}
|
||||
* @private
|
||||
|
@ -588,15 +588,15 @@ FixedColumns.prototype = {
|
|||
oGrid.wrapper.style.height = iHeight+"px";
|
||||
oGrid.left.body.style.height = $(this.dom.scroller).height()+"px";
|
||||
oGrid.left.wrapper.style.height = iHeight+"px";
|
||||
|
||||
|
||||
if ( this.s.iRightColumns > 0 )
|
||||
{
|
||||
oGrid.right.wrapper.style.height = iHeight+"px";
|
||||
oGrid.right.body.style.height = $(this.dom.scroller).height()+"px";
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Clone and position the fixed columns
|
||||
* @returns {void}
|
||||
|
@ -615,13 +615,13 @@ FixedColumns.prototype = {
|
|||
}
|
||||
|
||||
/* Event triggering */
|
||||
$(this).trigger( 'draw', {
|
||||
$(this).trigger( 'draw', {
|
||||
"leftClone": this.dom.clone.left,
|
||||
"rightClone": this.dom.clone.right
|
||||
} );
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Clone the right columns
|
||||
* @returns {void}
|
||||
|
@ -634,7 +634,7 @@ FixedColumns.prototype = {
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var that = this,
|
||||
i, jq,
|
||||
aiColumns = [];
|
||||
|
@ -646,8 +646,8 @@ FixedColumns.prototype = {
|
|||
|
||||
this._fnClone( this.dom.clone.right, this.dom.grid.right, aiColumns, bAll );
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Clone the left columns
|
||||
* @returns {void}
|
||||
|
@ -660,11 +660,11 @@ FixedColumns.prototype = {
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var that = this,
|
||||
i, jq,
|
||||
aiColumns = [];
|
||||
|
||||
|
||||
for ( i=0 ; i<this.s.iLeftColumns ; i++ )
|
||||
{
|
||||
aiColumns.push( i );
|
||||
|
@ -672,8 +672,8 @@ FixedColumns.prototype = {
|
|||
|
||||
this._fnClone( this.dom.clone.left, this.dom.grid.left, aiColumns, bAll );
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Make a copy of the layout object for a header or footer element from DataTables. Note that
|
||||
* this method will clone the nodes in the layout object.
|
||||
|
@ -720,19 +720,19 @@ FixedColumns.prototype = {
|
|||
} );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
aReturn.push( aRow );
|
||||
}
|
||||
|
||||
return aReturn;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Clone the DataTable nodes and place them in the DOM (sized correctly)
|
||||
* @returns {void}
|
||||
* @param {Object} oClone Object containing the header, footer and body cloned DOM elements
|
||||
* @param {Object} oGrid Grid object containing the display grid elements for the cloned
|
||||
* @param {Object} oGrid Grid object containing the display grid elements for the cloned
|
||||
* column (left or right)
|
||||
* @param {Array} aiColumns Column indexes which should be operated on from the DataTable
|
||||
* @param {Boolean} bAll Indicate if the header and footer should be updated as well (true)
|
||||
|
@ -743,7 +743,7 @@ FixedColumns.prototype = {
|
|||
var that = this,
|
||||
i, iLen, jq, nTarget, iColumn, nClone, iIndex;
|
||||
|
||||
/*
|
||||
/*
|
||||
* Header
|
||||
*/
|
||||
if ( bAll )
|
||||
|
@ -756,7 +756,7 @@ FixedColumns.prototype = {
|
|||
oClone.header.className += " DTFC_Cloned";
|
||||
oClone.header.style.width = "100%";
|
||||
oGrid.head.appendChild( oClone.header );
|
||||
|
||||
|
||||
/* Copy the DataTables layout cache for the header for our floating column */
|
||||
var aoCloneLayout = this._fnCopyLayout( this.s.dt.aoHeader, aiColumns );
|
||||
var jqCloneThead = $('>thead', oClone.header);
|
||||
|
@ -779,15 +779,15 @@ FixedColumns.prototype = {
|
|||
{
|
||||
$('>thead th:eq('+iIndex+')', oClone.header)[0].className =
|
||||
this.s.dt.aoColumns[ aiColumns[iIndex] ].nTh.className;
|
||||
|
||||
|
||||
$('>thead th:eq('+iIndex+') span.DataTables_sort_icon', oClone.header).each( function (i) {
|
||||
this.className = $('span.DataTables_sort_icon', that.s.dt.aoColumns[ aiColumns[iIndex] ].nTh)[i].className;
|
||||
} );
|
||||
}
|
||||
}
|
||||
this._fnEqualiseHeights( 'thead', this.dom.header, oClone.header );
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
* Body
|
||||
*/
|
||||
if ( this.s.sHeightMatch == 'auto' )
|
||||
|
@ -795,13 +795,13 @@ FixedColumns.prototype = {
|
|||
/* Remove any heights which have been applied already and let the browser figure it out */
|
||||
$('>tbody>tr', that.dom.body).css('height', 'auto');
|
||||
}
|
||||
|
||||
|
||||
if ( oClone.body !== null )
|
||||
{
|
||||
oClone.body.parentNode.removeChild( oClone.body );
|
||||
oClone.body = null;
|
||||
}
|
||||
|
||||
|
||||
oClone.body = $(this.dom.body).clone(true)[0];
|
||||
oClone.body.className += " DTFC_Cloned";
|
||||
oClone.body.style.paddingBottom = this.s.dt.oScroll.iBarWidth+"px";
|
||||
|
@ -810,10 +810,10 @@ FixedColumns.prototype = {
|
|||
{
|
||||
oClone.body.removeAttribute('id');
|
||||
}
|
||||
|
||||
|
||||
$('>thead>tr', oClone.body).empty();
|
||||
$('>tfoot', oClone.body).empty();
|
||||
|
||||
|
||||
var nBody = $('tbody', oClone.body)[0];
|
||||
$(nBody).empty();
|
||||
if ( this.s.dt.aiDisplay.length > 0 )
|
||||
|
@ -844,12 +844,12 @@ FixedColumns.prototype = {
|
|||
nBody.appendChild( nClone );
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
oClone.body.style.width = "100%";
|
||||
oGrid.body.appendChild( oClone.body );
|
||||
|
||||
this._fnEqualiseHeights( 'tbody', that.dom.body, oClone.body );
|
||||
|
||||
|
||||
/*
|
||||
* Footer
|
||||
*/
|
||||
|
@ -870,7 +870,7 @@ FixedColumns.prototype = {
|
|||
var aoCloneLayout = this._fnCopyLayout( this.s.dt.aoFooter, aiColumns );
|
||||
var jqCloneTfoot = $('>tfoot', oClone.footer);
|
||||
jqCloneTfoot.empty();
|
||||
|
||||
|
||||
for ( i=0, iLen=aoCloneLayout.length ; i<iLen ; i++ )
|
||||
{
|
||||
jqCloneTfoot[0].appendChild( aoCloneLayout[i].nTr );
|
||||
|
@ -906,8 +906,8 @@ FixedColumns.prototype = {
|
|||
}
|
||||
} );
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* From a given table node (THEAD etc), get a list of TR direct child elements
|
||||
* @param {Node} nIn Table element to search for TR elements (THEAD, TBODY or TFOOT element)
|
||||
|
@ -927,7 +927,7 @@ FixedColumns.prototype = {
|
|||
return aOut;
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Equalise the heights of the rows in a given table node in a cross browser way
|
||||
* @returns {void}
|
||||
|
@ -942,7 +942,7 @@ FixedColumns.prototype = {
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var that = this,
|
||||
i, iLen, iHeight, iHeight2, iHeightOriginal, iHeightClone,
|
||||
rootOriginal = original.getElementsByTagName(nodeName)[0],
|
||||
|
@ -951,10 +951,10 @@ FixedColumns.prototype = {
|
|||
iBoxHack = jqBoxHack.outerHeight() - jqBoxHack.height(),
|
||||
anOriginal = this._fnGetTrNodes( rootOriginal ),
|
||||
anClone = this._fnGetTrNodes( rootClone );
|
||||
|
||||
|
||||
for ( i=0, iLen=anClone.length ; i<iLen ; i++ )
|
||||
{
|
||||
if ( this.s.sHeightMatch == 'semiauto' && typeof anOriginal[i]._DTTC_iHeight != 'undefined' &&
|
||||
if ( this.s.sHeightMatch == 'semiauto' && typeof anOriginal[i]._DTTC_iHeight != 'undefined' &&
|
||||
anOriginal[i]._DTTC_iHeight !== null )
|
||||
{
|
||||
/* Oddly enough, IE / Chrome seem not to copy the style height - Mozilla and Opera keep it */
|
||||
|
@ -964,21 +964,21 @@ FixedColumns.prototype = {
|
|||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
iHeightOriginal = anOriginal[i].offsetHeight;
|
||||
iHeightClone = anClone[i].offsetHeight;
|
||||
iHeight = iHeightClone > iHeightOriginal ? iHeightClone : iHeightOriginal;
|
||||
|
||||
|
||||
if ( this.s.sHeightMatch == 'semiauto' )
|
||||
{
|
||||
anOriginal[i]._DTTC_iHeight = iHeight;
|
||||
}
|
||||
|
||||
|
||||
/* Can we use some kind of object detection here?! This is very nasty - damn browsers */
|
||||
if ( $.browser.msie )
|
||||
{
|
||||
$(anClone[i]).children().height( iHeight-iBoxHack );
|
||||
$(anOriginal[i]).children().height( iHeight-iBoxHack );
|
||||
$(anOriginal[i]).children().height( iHeight-iBoxHack );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1002,7 +1002,7 @@ FixedColumns.prototype = {
|
|||
* @static
|
||||
*/
|
||||
FixedColumns.defaults = {
|
||||
/**
|
||||
/**
|
||||
* Number of left hand columns to fix in position
|
||||
* @type int
|
||||
* @default 1
|
||||
|
@ -1016,8 +1016,8 @@ FixedColumns.defaults = {
|
|||
* } );
|
||||
*/
|
||||
"iLeftColumns": 1,
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Number of right hand columns to fix in position
|
||||
* @type int
|
||||
* @default 0
|
||||
|
@ -1031,8 +1031,8 @@ FixedColumns.defaults = {
|
|||
* } );
|
||||
*/
|
||||
"iRightColumns": 0,
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Draw callback function which is called when FixedColumns has redrawn the fixed assets
|
||||
* @type function(object, object):void
|
||||
* @default null
|
||||
|
@ -1048,8 +1048,8 @@ FixedColumns.defaults = {
|
|||
* } );
|
||||
*/
|
||||
"fnDrawCallback": null,
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Type of left column size calculation. Can take the values of "fixed", whereby the iLeftWidth
|
||||
* value will be treated as a pixel value, or "relative" for which case iLeftWidth will be
|
||||
* treated as a percentage value.
|
||||
|
@ -1066,8 +1066,8 @@ FixedColumns.defaults = {
|
|||
* } );
|
||||
*/
|
||||
"sLeftWidth": "fixed",
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Width to set for the width of the left fixed column(s) - note that the behaviour of this
|
||||
* property is directly effected by the sLeftWidth property. If not defined then this property
|
||||
* is calculated automatically from what has been assigned by DataTables.
|
||||
|
@ -1083,10 +1083,10 @@ FixedColumns.defaults = {
|
|||
* } );
|
||||
*/
|
||||
"iLeftWidth": null,
|
||||
|
||||
/**
|
||||
* Type of right column size calculation. Can take the values of "fixed", whereby the
|
||||
* iRightWidth value will be treated as a pixel value, or "relative" for which case
|
||||
|
||||
/**
|
||||
* Type of right column size calculation. Can take the values of "fixed", whereby the
|
||||
* iRightWidth value will be treated as a pixel value, or "relative" for which case
|
||||
* iRightWidth will be treated as a percentage value.
|
||||
* @type string
|
||||
* @default fixed
|
||||
|
@ -1101,7 +1101,7 @@ FixedColumns.defaults = {
|
|||
* } );
|
||||
*/
|
||||
"sRightWidth": "fixed",
|
||||
|
||||
|
||||
/**
|
||||
* Width to set for the width of the right fixed column(s) - note that the behaviour of this
|
||||
* property is directly effected by the sRightWidth property. If not defined then this property
|
||||
|
@ -1118,8 +1118,8 @@ FixedColumns.defaults = {
|
|||
* } );
|
||||
*/
|
||||
"iRightWidth": null,
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* Height matching algorthim to use. This can be "none" which will result in no height
|
||||
* matching being applied by FixedColumns (height matching could be forced by CSS in this
|
||||
* case), "semiauto" whereby the height calculation will be performed once, and the result
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* License: GPL v2 or BSD 3 point style
|
||||
* Project: Just a little bit of fun - enjoy :-)
|
||||
* Contact: www.sprymedia.co.uk/contact
|
||||
*
|
||||
*
|
||||
* Copyright 2009-2010 Allan Jardine, all rights reserved.
|
||||
*
|
||||
* This source file is free software, under either the GPL v2 license or a
|
||||
|
@ -41,7 +41,7 @@ var FixedHeader = function ( mTable, oInit ) {
|
|||
alert( "FixedHeader warning: FixedHeader must be initialised with the 'new' keyword." );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var that = this;
|
||||
var oSettings = {
|
||||
"aoCache": [],
|
||||
|
@ -69,7 +69,7 @@ var FixedHeader = function ( mTable, oInit ) {
|
|||
"bUseAbsPos": false,
|
||||
"bFooter": false
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Function: fnGetSettings
|
||||
* Purpose: Get the settings for this object
|
||||
|
@ -79,7 +79,7 @@ var FixedHeader = function ( mTable, oInit ) {
|
|||
this.fnGetSettings = function () {
|
||||
return oSettings;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Function: fnUpdate
|
||||
* Purpose: Update the positioning and copies of the fixed elements
|
||||
|
@ -90,7 +90,7 @@ var FixedHeader = function ( mTable, oInit ) {
|
|||
this._fnUpdateClones();
|
||||
this._fnUpdatePositions();
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Function: fnPosition
|
||||
* Purpose: Update the positioning of the fixed elements
|
||||
|
@ -100,10 +100,10 @@ var FixedHeader = function ( mTable, oInit ) {
|
|||
this.fnPosition = function () {
|
||||
this._fnUpdatePositions();
|
||||
};
|
||||
|
||||
|
||||
/* Let's do it */
|
||||
this.fnInit( mTable, oInit );
|
||||
|
||||
|
||||
/* Store the instance on the DataTables object for easy access */
|
||||
if ( typeof mTable.fnSettings == 'function' )
|
||||
{
|
||||
|
@ -121,7 +121,7 @@ FixedHeader.prototype = {
|
|||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Initialisation
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Function: fnInit
|
||||
* Purpose: The "constructor"
|
||||
|
@ -132,10 +132,10 @@ FixedHeader.prototype = {
|
|||
{
|
||||
var s = this.fnGetSettings();
|
||||
var that = this;
|
||||
|
||||
|
||||
/* Record the user definable settings */
|
||||
this.fnInitSettings( s, oInit );
|
||||
|
||||
|
||||
/* DataTables specific stuff */
|
||||
if ( typeof oTable.fnSettings == 'function' )
|
||||
{
|
||||
|
@ -146,15 +146,15 @@ FixedHeader.prototype = {
|
|||
"Please upgrade your DataTables installation" );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var oDtSettings = oTable.fnSettings();
|
||||
|
||||
|
||||
if ( oDtSettings.oScroll.sX != "" || oDtSettings.oScroll.sY != "" )
|
||||
{
|
||||
alert( "FixedHeader 2 is not supported with DataTables' scrolling mode at this time" );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
s.nTable = oDtSettings.nTable;
|
||||
oDtSettings.aoDrawCallback.push( {
|
||||
"fn": function () {
|
||||
|
@ -169,12 +169,12 @@ FixedHeader.prototype = {
|
|||
{
|
||||
s.nTable = oTable;
|
||||
}
|
||||
|
||||
|
||||
s.bFooter = ($('>tfoot', s.nTable).length > 0) ? true : false;
|
||||
|
||||
|
||||
/* "Detect" browsers that don't support absolute positioing - or have bugs */
|
||||
s.bUseAbsPos = (jQuery.browser.msie && (jQuery.browser.version=="6.0"||jQuery.browser.version=="7.0"));
|
||||
|
||||
|
||||
/* Add the 'sides' that are fixed */
|
||||
if ( s.oSides.top )
|
||||
{
|
||||
|
@ -192,29 +192,29 @@ FixedHeader.prototype = {
|
|||
{
|
||||
s.aoCache.push( that._fnCloneTable( "fixedRight", "FixedHeader_Right", that._fnCloneTRight ) );
|
||||
}
|
||||
|
||||
|
||||
/* Event listeners for window movement */
|
||||
FixedHeader.afnScroll.push( function () {
|
||||
that._fnUpdatePositions.call(that);
|
||||
} );
|
||||
|
||||
|
||||
jQuery(window).resize( function () {
|
||||
FixedHeader.fnMeasure();
|
||||
that._fnUpdateClones.call(that);
|
||||
that._fnUpdatePositions.call(that);
|
||||
} );
|
||||
|
||||
|
||||
/* Get things right to start with */
|
||||
FixedHeader.fnMeasure();
|
||||
that._fnUpdateClones();
|
||||
that._fnUpdatePositions();
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Support functions
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Function: fnInitSettings
|
||||
* Purpose: Take the user's settings and copy them to our local store
|
||||
|
@ -238,7 +238,7 @@ FixedHeader.prototype = {
|
|||
if ( typeof oInit.right != 'undefined' ) {
|
||||
s.oSides.right = oInit.right;
|
||||
}
|
||||
|
||||
|
||||
if ( typeof oInit.zTop != 'undefined' ) {
|
||||
s.oZIndexes.top = oInit.zTop;
|
||||
}
|
||||
|
@ -252,15 +252,15 @@ FixedHeader.prototype = {
|
|||
s.oZIndexes.right = oInit.zRight;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Detect browsers which have poor position:fixed support so we can use absolute positions.
|
||||
* This is much slower since the position must be updated for each scroll, but widens
|
||||
* compatibility
|
||||
*/
|
||||
s.bUseAbsPos = (jQuery.browser.msie &&
|
||||
s.bUseAbsPos = (jQuery.browser.msie &&
|
||||
(jQuery.browser.version=="6.0"||jQuery.browser.version=="7.0"));
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
* Function: _fnCloneTable
|
||||
* Purpose: Clone the table node and do basic initialisation
|
||||
|
@ -271,7 +271,7 @@ FixedHeader.prototype = {
|
|||
{
|
||||
var s = this.fnGetSettings();
|
||||
var nCTable;
|
||||
|
||||
|
||||
/* We know that the table _MUST_ has a DIV wrapped around it, because this is simply how
|
||||
* DataTables works. Therefore, we can set this to be relatively position (if it is not
|
||||
* alreadu absolute, and use this as the base point for the cloned header
|
||||
|
@ -280,17 +280,17 @@ FixedHeader.prototype = {
|
|||
{
|
||||
s.nTable.parentNode.style.position = "relative";
|
||||
}
|
||||
|
||||
|
||||
/* Just a shallow clone will do - we only want the table node */
|
||||
nCTable = s.nTable.cloneNode( false );
|
||||
nCTable.removeAttribute( 'id' );
|
||||
|
||||
|
||||
var nDiv = document.createElement( 'div' );
|
||||
nDiv.style.position = "absolute";
|
||||
nDiv.style.top = "0px";
|
||||
nDiv.style.left = "0px";
|
||||
nDiv.className += " FixedHeader_Cloned "+sType+" "+sClass;
|
||||
|
||||
|
||||
/* Set the zIndexes */
|
||||
if ( sType == "fixedHeader" )
|
||||
{
|
||||
|
@ -311,11 +311,11 @@ FixedHeader.prototype = {
|
|||
|
||||
/* remove margins since we are going to poistion it absolutely */
|
||||
nCTable.style.margin = "0";
|
||||
|
||||
|
||||
/* Insert the newly cloned table into the DOM, on top of the "real" header */
|
||||
nDiv.appendChild( nCTable );
|
||||
document.body.appendChild( nDiv );
|
||||
|
||||
|
||||
return {
|
||||
"nNode": nCTable,
|
||||
"nWrapper": nDiv,
|
||||
|
@ -326,7 +326,7 @@ FixedHeader.prototype = {
|
|||
"fnClone": fnClone
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
* Function: _fnUpdatePositions
|
||||
* Purpose: Get the current positioning of the table in the DOM
|
||||
|
@ -342,7 +342,7 @@ FixedHeader.prototype = {
|
|||
oOffset = jqTable.offset(),
|
||||
iParentScrollTop = this._fnSumScroll( s.nTable.parentNode, 'scrollTop' ),
|
||||
iParentScrollLeft = this._fnSumScroll( s.nTable.parentNode, 'scrollLeft' );
|
||||
|
||||
|
||||
m.iTableWidth = jqTable.outerWidth();
|
||||
m.iTableHeight = jqTable.outerHeight();
|
||||
m.iTableLeft = oOffset.left + s.nTable.parentNode.scrollLeft;
|
||||
|
@ -351,7 +351,7 @@ FixedHeader.prototype = {
|
|||
m.iTableRight = FixedHeader.oDoc.iWidth - m.iTableLeft - m.iTableWidth;
|
||||
m.iTableBottom = FixedHeader.oDoc.iHeight - m.iTableTop - m.iTableHeight;
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
* Function: _fnSumScroll
|
||||
* Purpose: Sum node parameters all the way to the top
|
||||
|
@ -372,7 +372,7 @@ FixedHeader.prototype = {
|
|||
}
|
||||
return i;
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
* Function: _fnUpdatePositions
|
||||
* Purpose: Loop over the fixed elements for this table and update their positions
|
||||
|
@ -383,7 +383,7 @@ FixedHeader.prototype = {
|
|||
{
|
||||
var s = this.fnGetSettings();
|
||||
this._fnMeasure();
|
||||
|
||||
|
||||
for ( var i=0, iLen=s.aoCache.length ; i<iLen ; i++ )
|
||||
{
|
||||
if ( s.aoCache[i].sType == "fixedHeader" )
|
||||
|
@ -404,7 +404,7 @@ FixedHeader.prototype = {
|
|||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
* Function: _fnUpdateClones
|
||||
* Purpose: Loop over the fixed elements for this table and call their cloning functions
|
||||
|
@ -419,12 +419,12 @@ FixedHeader.prototype = {
|
|||
s.aoCache[i].fnClone.call( this, s.aoCache[i] );
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Scrolling functions
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Function: _fnScrollHorizontalLeft
|
||||
* Purpose: Update the positioning of the scrolling elements
|
||||
|
@ -440,13 +440,13 @@ FixedHeader.prototype = {
|
|||
oDoc = FixedHeader.oDoc,
|
||||
nTable = oCache.nWrapper,
|
||||
iFixedWidth = jQuery(nTable).outerWidth();
|
||||
|
||||
|
||||
if ( oWin.iScrollRight < oMes.iTableRight )
|
||||
{
|
||||
/* Fully right aligned */
|
||||
this._fnUpdateCache( oCache, 'sPosition', 'absolute', 'position', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sTop', oMes.iTableTop+"px", 'top', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sLeft', (oMes.iTableLeft+oMes.iTableWidth-iFixedWidth)+"px", 'left', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sLeft', (oMes.iTableLeft+oMes.iTableWidth-iFixedWidth)+"px", 'left', nTable.style );
|
||||
}
|
||||
else if ( oMes.iTableLeft < oDoc.iWidth-oWin.iScrollRight-iFixedWidth )
|
||||
{
|
||||
|
@ -462,17 +462,17 @@ FixedHeader.prototype = {
|
|||
this._fnUpdateCache( oCache, 'sPosition', 'fixed', 'position', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sTop', (oMes.iTableTop-oWin.iScrollTop)+"px", 'top', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sLeft', (oWin.iWidth-iFixedWidth)+"px", 'left', nTable.style );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Fully left aligned */
|
||||
this._fnUpdateCache( oCache, 'sPosition', 'absolute', 'position', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sTop', oMes.iTableTop+"px", 'top', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sLeft', oMes.iTableLeft+"px", 'left', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sLeft', oMes.iTableLeft+"px", 'left', nTable.style );
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
* Function: _fnScrollHorizontalLeft
|
||||
* Purpose: Update the positioning of the scrolling elements
|
||||
|
@ -488,13 +488,13 @@ FixedHeader.prototype = {
|
|||
oDoc = FixedHeader.oDoc,
|
||||
nTable = oCache.nWrapper,
|
||||
iCellWidth = jQuery(nTable).outerWidth();
|
||||
|
||||
|
||||
if ( oWin.iScrollLeft < oMes.iTableLeft )
|
||||
{
|
||||
/* Fully left align */
|
||||
this._fnUpdateCache( oCache, 'sPosition', 'absolute', 'position', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sTop', oMes.iTableTop+"px", 'top', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sLeft', oMes.iTableLeft+"px", 'left', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sLeft', oMes.iTableLeft+"px", 'left', nTable.style );
|
||||
}
|
||||
else if ( oWin.iScrollLeft < oMes.iTableLeft+oMes.iTableWidth-iCellWidth )
|
||||
{
|
||||
|
@ -510,17 +510,17 @@ FixedHeader.prototype = {
|
|||
this._fnUpdateCache( oCache, 'sPosition', 'fixed', 'position', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sTop', (oMes.iTableTop-oWin.iScrollTop)+"px", 'top', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sLeft', "0px", 'left', nTable.style );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Fully right align */
|
||||
this._fnUpdateCache( oCache, 'sPosition', 'absolute', 'position', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sTop', oMes.iTableTop+"px", 'top', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sLeft', (oMes.iTableLeft+oMes.iTableWidth-iCellWidth)+"px", 'left', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sLeft', (oMes.iTableLeft+oMes.iTableWidth-iCellWidth)+"px", 'left', nTable.style );
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
* Function: _fnScrollFixedFooter
|
||||
* Purpose: Update the positioning of the scrolling elements
|
||||
|
@ -537,13 +537,13 @@ FixedHeader.prototype = {
|
|||
nTable = oCache.nWrapper,
|
||||
iTheadHeight = jQuery("thead", s.nTable).outerHeight(),
|
||||
iCellHeight = jQuery(nTable).outerHeight();
|
||||
|
||||
|
||||
if ( oWin.iScrollBottom < oMes.iTableBottom )
|
||||
{
|
||||
/* Below */
|
||||
this._fnUpdateCache( oCache, 'sPosition', 'absolute', 'position', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sTop', (oMes.iTableTop+oMes.iTableHeight-iCellHeight)+"px", 'top', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sLeft', oMes.iTableLeft+"px", 'left', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sLeft', oMes.iTableLeft+"px", 'left', nTable.style );
|
||||
}
|
||||
else if ( oWin.iScrollBottom < oMes.iTableBottom+oMes.iTableHeight-iCellHeight-iTheadHeight )
|
||||
{
|
||||
|
@ -558,7 +558,7 @@ FixedHeader.prototype = {
|
|||
{
|
||||
this._fnUpdateCache( oCache, 'sPosition', 'fixed', 'position', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sTop', (oWin.iHeight-iCellHeight)+"px", 'top', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sLeft', (oMes.iTableLeft-oWin.iScrollLeft)+"px", 'left', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sLeft', (oMes.iTableLeft-oWin.iScrollLeft)+"px", 'left', nTable.style );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -566,10 +566,10 @@ FixedHeader.prototype = {
|
|||
/* Above */
|
||||
this._fnUpdateCache( oCache, 'sPosition', 'absolute', 'position', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sTop', (oMes.iTableTop+iCellHeight)+"px", 'top', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sLeft', oMes.iTableLeft+"px", 'left', nTable.style );
|
||||
this._fnUpdateCache( oCache, 'sLeft', oMes.iTableLeft+"px", 'left', nTable.style );
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
* Function: _fnScrollFixedHeader
|
||||
* Purpose: Update the positioning of the scrolling elements
|
||||
|
@ -585,7 +585,7 @@ FixedHeader.prototype = {
|
|||
oDoc = FixedHeader.oDoc,
|
||||
nTable = oCache.nWrapper,
|
||||
iTbodyHeight = s.nTable.getElementsByTagName('tbody')[0].offsetHeight;
|
||||
|
||||
|
||||
if ( oMes.iTableTop > oWin.iScrollTop )
|
||||
{
|
||||
/* Above the table */
|
||||
|
@ -617,7 +617,7 @@ FixedHeader.prototype = {
|
|||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
* Function: _fnUpdateCache
|
||||
* Purpose: Check the cache and update cache and value if needed
|
||||
|
@ -636,13 +636,13 @@ FixedHeader.prototype = {
|
|||
oCache[sCache] = sSet;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Cloning functions
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Function: _fnCloneThead
|
||||
* Purpose: Clone the thead element
|
||||
|
@ -653,31 +653,31 @@ FixedHeader.prototype = {
|
|||
{
|
||||
var s = this.fnGetSettings();
|
||||
var nTable = oCache.nNode;
|
||||
|
||||
|
||||
/* Set the wrapper width to match that of the cloned table */
|
||||
oCache.nWrapper.style.width = jQuery(s.nTable).outerWidth()+"px";
|
||||
|
||||
|
||||
/* Remove any children the cloned table has */
|
||||
while ( nTable.childNodes.length > 0 )
|
||||
{
|
||||
jQuery('thead th', nTable).unbind( 'click' );
|
||||
nTable.removeChild( nTable.childNodes[0] );
|
||||
}
|
||||
|
||||
|
||||
/* Clone the DataTables header */
|
||||
var nThead = jQuery('thead', s.nTable).clone(true)[0];
|
||||
nTable.appendChild( nThead );
|
||||
|
||||
|
||||
/* Copy the widths across - apparently a clone isn't good enough for this */
|
||||
jQuery("thead>tr th", s.nTable).each( function (i) {
|
||||
jQuery("thead>tr th:eq("+i+")", nTable).width( jQuery(this).width() );
|
||||
} );
|
||||
|
||||
|
||||
jQuery("thead>tr td", s.nTable).each( function (i) {
|
||||
jQuery("thead>tr td:eq("+i+")", nTable).width( jQuery(this).width() );
|
||||
} );
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
* Function: _fnCloneTfoot
|
||||
* Purpose: Clone the tfoot element
|
||||
|
@ -688,30 +688,30 @@ FixedHeader.prototype = {
|
|||
{
|
||||
var s = this.fnGetSettings();
|
||||
var nTable = oCache.nNode;
|
||||
|
||||
|
||||
/* Set the wrapper width to match that of the cloned table */
|
||||
oCache.nWrapper.style.width = jQuery(s.nTable).outerWidth()+"px";
|
||||
|
||||
|
||||
/* Remove any children the cloned table has */
|
||||
while ( nTable.childNodes.length > 0 )
|
||||
{
|
||||
nTable.removeChild( nTable.childNodes[0] );
|
||||
}
|
||||
|
||||
|
||||
/* Clone the DataTables footer */
|
||||
var nTfoot = jQuery('tfoot', s.nTable).clone(true)[0];
|
||||
nTable.appendChild( nTfoot );
|
||||
|
||||
|
||||
/* Copy the widths across - apparently a clone isn't good enough for this */
|
||||
jQuery("tfoot:eq(0)>tr th", s.nTable).each( function (i) {
|
||||
jQuery("tfoot:eq(0)>tr th:eq("+i+")", nTable).width( jQuery(this).width() );
|
||||
} );
|
||||
|
||||
|
||||
jQuery("tfoot:eq(0)>tr td", s.nTable).each( function (i) {
|
||||
jQuery("tfoot:eq(0)>tr th:eq("+i+")", nTable)[0].style.width( jQuery(this).width() );
|
||||
} );
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
* Function: _fnCloneTLeft
|
||||
* Purpose: Clone the left column
|
||||
|
@ -725,13 +725,13 @@ FixedHeader.prototype = {
|
|||
var nBody = $('tbody', s.nTable)[0];
|
||||
var iCols = $('tbody tr:eq(0) td', s.nTable).length;
|
||||
var bRubbishOldIE = ($.browser.msie && ($.browser.version == "6.0" || $.browser.version == "7.0"));
|
||||
|
||||
|
||||
/* Remove any children the cloned table has */
|
||||
while ( nTable.childNodes.length > 0 )
|
||||
{
|
||||
nTable.removeChild( nTable.childNodes[0] );
|
||||
}
|
||||
|
||||
|
||||
/* Is this the most efficient way to do this - it looks horrible... */
|
||||
nTable.appendChild( jQuery("thead", s.nTable).clone(true)[0] );
|
||||
nTable.appendChild( jQuery("tbody", s.nTable).clone(true)[0] );
|
||||
|
@ -739,22 +739,22 @@ FixedHeader.prototype = {
|
|||
{
|
||||
nTable.appendChild( jQuery("tfoot", s.nTable).clone(true)[0] );
|
||||
}
|
||||
|
||||
|
||||
jQuery('thead tr th:gt(0)', nTable).remove();
|
||||
jQuery('tfoot tr th:gt(0)', nTable).remove();
|
||||
|
||||
|
||||
/* Remove unneeded cells */
|
||||
$('tbody tr', nTable).each( function (k) {
|
||||
$('td:gt(0)', this).remove();
|
||||
} );
|
||||
|
||||
|
||||
this.fnEqualiseHeights( 'tbody', nBody.parentNode, nTable );
|
||||
|
||||
|
||||
var iWidth = jQuery('thead tr th:eq(0)', s.nTable).outerWidth();
|
||||
nTable.style.width = iWidth+"px";
|
||||
oCache.nWrapper.style.width = iWidth+"px";
|
||||
},
|
||||
|
||||
|
||||
/*
|
||||
* Function: _fnCloneTRight
|
||||
* Purpose: Clone the right most colun
|
||||
|
@ -768,13 +768,13 @@ FixedHeader.prototype = {
|
|||
var nTable = oCache.nNode;
|
||||
var iCols = jQuery('tbody tr:eq(0) td', s.nTable).length;
|
||||
var bRubbishOldIE = ($.browser.msie && ($.browser.version == "6.0" || $.browser.version == "7.0"));
|
||||
|
||||
|
||||
/* Remove any children the cloned table has */
|
||||
while ( nTable.childNodes.length > 0 )
|
||||
{
|
||||
nTable.removeChild( nTable.childNodes[0] );
|
||||
}
|
||||
|
||||
|
||||
/* Is this the most efficient way to do this - it looks horrible... */
|
||||
nTable.appendChild( jQuery("thead", s.nTable).clone(true)[0] );
|
||||
nTable.appendChild( jQuery("tbody", s.nTable).clone(true)[0] );
|
||||
|
@ -784,20 +784,20 @@ FixedHeader.prototype = {
|
|||
}
|
||||
jQuery('thead tr th:not(:nth-child('+iCols+'n))', nTable).remove();
|
||||
jQuery('tfoot tr th:not(:nth-child('+iCols+'n))', nTable).remove();
|
||||
|
||||
|
||||
/* Remove unneeded cells */
|
||||
$('tbody tr', nTable).each( function (k) {
|
||||
$('td:lt('+(iCols-1)+')', this).remove();
|
||||
} );
|
||||
|
||||
|
||||
this.fnEqualiseHeights( 'tbody', nBody.parentNode, nTable );
|
||||
|
||||
|
||||
var iWidth = jQuery('thead tr th:eq('+(iCols-1)+')', s.nTable).outerWidth();
|
||||
nTable.style.width = iWidth+"px";
|
||||
oCache.nWrapper.style.width = iWidth+"px";
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Equalise the heights of the rows in a given table node in a cross browser way. Note that this
|
||||
* is more or less lifted as is from FixedColumns
|
||||
|
@ -814,7 +814,7 @@ FixedHeader.prototype = {
|
|||
jqBoxHack = $(parent+' tr:eq(0)', original).children(':eq(0)'),
|
||||
iBoxHack = jqBoxHack.outerHeight() - jqBoxHack.height(),
|
||||
bRubbishOldIE = ($.browser.msie && ($.browser.version == "6.0" || $.browser.version == "7.0"));
|
||||
|
||||
|
||||
/* Remove cells which are not needed and copy the height from the original table */
|
||||
$(parent+' tr', clone).each( function (k) {
|
||||
/* Can we use some kind of object detection here?! This is very nasty - damn browsers */
|
||||
|
@ -826,16 +826,16 @@ FixedHeader.prototype = {
|
|||
{
|
||||
$(this).children().height( $(parent+' tr:eq('+k+')', original).outerHeight() - iBoxHack );
|
||||
}
|
||||
|
||||
|
||||
if ( !bRubbishOldIE )
|
||||
{
|
||||
$(parent+' tr:eq('+k+')', original).height( $(parent+' tr:eq('+k+')', original).outerHeight() );
|
||||
$(parent+' tr:eq('+k+')', original).height( $(parent+' tr:eq('+k+')', original).outerHeight() );
|
||||
}
|
||||
} );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Static properties and methods
|
||||
* We use these for speed! This information is common to all instances of FixedHeader, so no
|
||||
|
@ -886,10 +886,10 @@ FixedHeader.fnMeasure = function ()
|
|||
jqDoc = jQuery(document),
|
||||
oWin = FixedHeader.oWin,
|
||||
oDoc = FixedHeader.oDoc;
|
||||
|
||||
|
||||
oDoc.iHeight = jqDoc.height();
|
||||
oDoc.iWidth = jqDoc.width();
|
||||
|
||||
|
||||
oWin.iHeight = jqWin.height();
|
||||
oWin.iWidth = jqWin.width();
|
||||
oWin.iScrollTop = jqWin.scrollTop();
|
||||
|
@ -898,7 +898,7 @@ FixedHeader.fnMeasure = function ()
|
|||
oWin.iScrollBottom = oDoc.iHeight - oWin.iScrollTop - oWin.iHeight;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Global processing
|
||||
*/
|
||||
|
|
|
@ -739,7 +739,7 @@ ColReorder.prototype = {
|
|||
this.s.dt.oInstance.oApi._fnSaveState( this.s.dt );
|
||||
|
||||
this._fnSetColumnIndexes();
|
||||
|
||||
|
||||
if ( this.s.reorderCallback !== null )
|
||||
{
|
||||
this.s.reorderCallback.call( this );
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* File: jquery.dataTables.columnFilter.js
|
||||
* Version: 1.4.8.
|
||||
* Author: Jovan Popovic
|
||||
*
|
||||
* Author: Jovan Popovic
|
||||
*
|
||||
* Copyright 2011-2012 Jovan Popovic, all rights reserved.
|
||||
*
|
||||
* This source file is free software, under either the GPL v2 license or a
|
||||
* BSD style license, as supplied with this software.
|
||||
*
|
||||
* This source file is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*
|
||||
* This source file is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* Parameters:"
|
||||
* @sPlaceHolder String Place where inline filtering function should be placed ("tfoot", "thead:before", "thead:after"). Default is "tfoot"
|
||||
* @sRangeSeparator String Separator that will be used when range values are sent to the server-side. Default value is "~".
|
||||
|
@ -65,7 +65,7 @@
|
|||
// use all rows
|
||||
else aiRows = oSettings.aiDisplayMaster; // all row numbers
|
||||
|
||||
// set up data array
|
||||
// set up data array
|
||||
var asResultData = new Array();
|
||||
|
||||
for (var i = 0, c = aiRows.length; i < c; i++) {
|
||||
|
@ -139,7 +139,7 @@
|
|||
if (oTable.fnSettings().oFeatures.bServerSide && iFilterLength != 0) {
|
||||
//If filter length is set in the server-side processing mode
|
||||
//Check has the user entered at least iFilterLength new characters
|
||||
|
||||
|
||||
var currentFilter = oTable.fnSettings().aoPreSearchCols[index].sSearch;
|
||||
var iLastFilterLength = $(this).data("dt-iLastFilterLength");
|
||||
if (typeof iLastFilterLength == "undefined")
|
||||
|
@ -181,7 +181,7 @@
|
|||
function fnCreateRangeInput(oTable) {
|
||||
|
||||
//var currentFilter = oTable.fnSettings().aoPreSearchCols[i].sSearch;
|
||||
|
||||
|
||||
var label = "";
|
||||
if (th.attr('id') == "bit_rate") {
|
||||
label = $.i18n._("kbps");
|
||||
|
@ -192,7 +192,7 @@
|
|||
} else if (th.attr('id') == "sample_rate") {
|
||||
label = $.i18n._("kHz");
|
||||
}
|
||||
|
||||
|
||||
th.html(_fnRangeLabelPart(0));
|
||||
var sFromId = oTable.attr("id") + '_range_from_' + i;
|
||||
var from = $('<input type="text" class="number_range_filter" id="' + sFromId + '" rel="' + i + '" placeholder="' + label + '"/>');
|
||||
|
@ -251,7 +251,7 @@
|
|||
var iMax = document.getElementById(sToId).value * 1;
|
||||
if (iMin != 0 && iMax != 0 && iMin > iMax)
|
||||
return;
|
||||
|
||||
|
||||
oTable.fnDraw();
|
||||
fnOnFiltered();
|
||||
}
|
||||
|
@ -377,8 +377,8 @@
|
|||
function fnCreateSelect(oTable, aData, bRegex) {
|
||||
var oSettings = oTable.fnSettings();
|
||||
if (aData == null && oSettings.sAjaxSource != "" && !oSettings.oFeatures.bServerSide) {
|
||||
// Add a function to the draw callback, which will check for the Ajax data having
|
||||
// been loaded. Use a closure for the individual column elements that are used to
|
||||
// Add a function to the draw callback, which will check for the Ajax data having
|
||||
// been loaded. Use a closure for the individual column elements that are used to
|
||||
// built the column filter, since 'i' and 'th' (etc) are locally "global".
|
||||
oSettings.aoDrawCallback.push({
|
||||
"fn": (function (iColumn, nTh, sLabel) {
|
||||
|
@ -557,7 +557,7 @@
|
|||
});
|
||||
oTable.fnFilter('', index, true, false);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
|
@ -589,7 +589,7 @@
|
|||
};
|
||||
|
||||
properties = $.extend(defaults, options);
|
||||
|
||||
|
||||
return this.each(function () {
|
||||
|
||||
if (!oTable.fnSettings().oFeatures.bFilter)
|
||||
|
@ -636,7 +636,7 @@
|
|||
|
||||
oHost = oTable.fnSettings().nTHead;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//$(sFilterRow + " th", oHost).each(function (index) {//bug with ColVis
|
||||
|
@ -700,7 +700,7 @@
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
for (j = 0; j < aiCustomSearch_Indexes.length; j++) {
|
||||
//var index = aiCustomSearch_Indexes[j];
|
||||
var fnSearch_ = function () {
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*
|
||||
* File: jquery.dataTables.columnFilter.js
|
||||
* Version: 1.4.8.
|
||||
* Author: Jovan Popovic
|
||||
*
|
||||
* Author: Jovan Popovic
|
||||
*
|
||||
* Copyright 2011-2012 Jovan Popovic, all rights reserved.
|
||||
*
|
||||
* This source file is free software, under either the GPL v2 license or a
|
||||
* BSD style license, as supplied with this software.
|
||||
*
|
||||
* This source file is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
*
|
||||
* This source file is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* Parameters:"
|
||||
* @sPlaceHolder String Place where inline filtering function should be placed ("tfoot", "thead:before", "thead:after"). Default is "tfoot"
|
||||
* @sRangeSeparator String Separator that will be used when range values are sent to the server-side. Default value is "~".
|
||||
|
@ -65,7 +65,7 @@
|
|||
// use all rows
|
||||
else aiRows = oSettings.aiDisplayMaster; // all row numbers
|
||||
|
||||
// set up data array
|
||||
// set up data array
|
||||
var asResultData = new Array();
|
||||
|
||||
for (var i = 0, c = aiRows.length; i < c; i++) {
|
||||
|
@ -358,8 +358,8 @@
|
|||
function fnCreateSelect(oTable, aData, bRegex) {
|
||||
var oSettings = oTable.fnSettings();
|
||||
if (aData == null && oSettings.sAjaxSource != "" && !oSettings.oFeatures.bServerSide) {
|
||||
// Add a function to the draw callback, which will check for the Ajax data having
|
||||
// been loaded. Use a closure for the individual column elements that are used to
|
||||
// Add a function to the draw callback, which will check for the Ajax data having
|
||||
// been loaded. Use a closure for the individual column elements that are used to
|
||||
// built the column filter, since 'i' and 'th' (etc) are locally "global".
|
||||
oSettings.aoDrawCallback.push({
|
||||
"fn": (function (iColumn, nTh, sLabel) {
|
||||
|
@ -538,7 +538,7 @@
|
|||
});
|
||||
oTable.fnFilter('', index, true, false);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
|
@ -570,7 +570,7 @@
|
|||
};
|
||||
|
||||
properties = $.extend(defaults, options);
|
||||
|
||||
|
||||
return this.each(function () {
|
||||
|
||||
if (!oTable.fnSettings().oFeatures.bFilter)
|
||||
|
@ -617,7 +617,7 @@
|
|||
|
||||
oHost = oTable.fnSettings().nTHead;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//$(sFilterRow + " th", oHost).each(function (index) {//bug with ColVis
|
||||
|
@ -681,7 +681,7 @@
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
for (j = 0; j < aiCustomSearch_Indexes.length; j++) {
|
||||
//var index = aiCustomSearch_Indexes[j];
|
||||
var fnSearch_ = function () {
|
||||
|
@ -730,4 +730,4 @@
|
|||
|
||||
|
||||
|
||||
})(jQuery);
|
||||
})(jQuery);
|
||||
|
|
|
@ -14,24 +14,24 @@ jQuery.fn.dataTableExt.oApi.fnSetFilteringDelay = function ( oSettings, iDelay )
|
|||
this.each( function ( i ) {
|
||||
$.fn.dataTableExt.iApiIndex = i;
|
||||
var
|
||||
$this = this,
|
||||
oTimerId = null,
|
||||
$this = this,
|
||||
oTimerId = null,
|
||||
sPreviousSearch = null,
|
||||
anControl = $( 'input', _that.fnSettings().aanFeatures.f );
|
||||
|
||||
|
||||
anControl.unbind( 'keyup' ).bind( 'keyup', function() {
|
||||
var $$this = $this;
|
||||
|
||||
if (sPreviousSearch === null || sPreviousSearch != anControl.val()) {
|
||||
window.clearTimeout(oTimerId);
|
||||
sPreviousSearch = anControl.val();
|
||||
sPreviousSearch = anControl.val();
|
||||
oTimerId = window.setTimeout(function() {
|
||||
$.fn.dataTableExt.iApiIndex = i;
|
||||
_that.fnFilter( anControl.val() );
|
||||
}, iDelay);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return this;
|
||||
} );
|
||||
return this;
|
||||
|
|
|
@ -12,7 +12,7 @@ $.fn.dataTableExt.oApi.fnStandingRedraw = function(oSettings) {
|
|||
oSettings._iDisplayStart = before;
|
||||
oSettings.oApi._fnCalculateEnd(oSettings);
|
||||
}
|
||||
|
||||
|
||||
//draw the 'current' page
|
||||
oSettings.oApi._fnDraw(oSettings);
|
||||
};
|
||||
|
@ -22,13 +22,13 @@ $.fn.dataTableExt.oApi.fnAddDataAndDisplay = function ( oSettings, aData )
|
|||
/* Add the data */
|
||||
var iAdded = this.oApi._fnAddData( oSettings, aData );
|
||||
var nAdded = oSettings.aoData[ iAdded ].nTr;
|
||||
|
||||
|
||||
/* Need to re-filter and re-sort the table to get positioning correct, not perfect
|
||||
* as this will actually redraw the table on screen, but the update should be so fast (and
|
||||
* possibly not alter what is already on display) that the user will not notice
|
||||
*/
|
||||
this.oApi._fnReDraw( oSettings );
|
||||
|
||||
|
||||
/* Find it's position in the table */
|
||||
var iPos = -1;
|
||||
for( var i=0, iLen=oSettings.aiDisplay.length ; i<iLen ; i++ )
|
||||
|
@ -39,17 +39,17 @@ $.fn.dataTableExt.oApi.fnAddDataAndDisplay = function ( oSettings, aData )
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Get starting point, taking account of paging */
|
||||
if( iPos >= 0 )
|
||||
{
|
||||
oSettings._iDisplayStart = ( Math.floor(i / oSettings._iDisplayLength) ) * oSettings._iDisplayLength;
|
||||
this.oApi._fnCalculateEnd( oSettings );
|
||||
}
|
||||
|
||||
|
||||
this.oApi._fnDraw( oSettings );
|
||||
return {
|
||||
"nTr": nAdded,
|
||||
"iPos": iAdded
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue