From e55841cbc8ee5879699f2d9078cb2ccd9f7a11ab Mon Sep 17 00:00:00 2001 From: Matt Parnell Date: Tue, 13 Nov 2012 15:03:38 -0600 Subject: [PATCH 1/3] enable show/hide on serverside processing table columns without reloading the data (unless of course, you're reordering the data or changing pages) --- media/js/ColVis.js | 73 +++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 40 deletions(-) diff --git a/media/js/ColVis.js b/media/js/ColVis.js index b049e63..06bcf98 100755 --- a/media/js/ColVis.js +++ b/media/js/ColVis.js @@ -1,6 +1,6 @@ /* * File: ColVis.js - * Version: 1.0.9.dev + * Version: 1.0.8 * CVS: $Id$ * Description: Controls for column visiblity in DataTables * Author: Allan Jardine (www.sprymedia.co.uk) @@ -159,7 +159,7 @@ ColVis = function( oDTSettings, oInit ) * @type Integer * @default 500 */ - "iOverlayFade": 500, + "iOverlayFade": 0, /** * Label callback for column names. Takes three parameters: 1. the column index, 2. the column @@ -610,18 +610,15 @@ ColVis.prototype = { var oldIndex = $.fn.dataTableExt.iApiIndex; $.fn.dataTableExt.iApiIndex = that._fnDataTablesApiIndex.call(that); - // Optimisation for server-side processing when scrolling - don't do a full redraw + that.s.dt.oInstance.fnSetColumnVis( i, showHide, false ); + that.s.dt.oInstance.fnAdjustColumnSizing( false ); + if ( dt.oFeatures.bServerSide && (dt.oScroll.sX !== "" || dt.oScroll.sY !== "" ) ) { - that.s.dt.oInstance.fnSetColumnVis( i, showHide, false ); - that.s.dt.oInstance.fnAdjustColumnSizing( false ); - that.s.dt.oInstance.oApi._fnScrollDraw( that.s.dt ); - that._fnDrawCallback(); - } - else - { - that.s.dt.oInstance.fnSetColumnVis( i, showHide ); + that.s.dt.oInstance.oApi._fnScrollDraw( that.s.dt ); } + + that._fnDrawCallback(); $.fn.dataTableExt.iApiIndex = oldIndex; /* Restore */ @@ -774,7 +771,7 @@ ColVis.prototype = { */ "_fnCollectionShow": function () { - var that = this, i, iLen, iLeft; + var that = this, i, iLen; var oPos = $(this.dom.button).offset(); var nHidden = this.dom.collection; var nBackground = this.dom.background; @@ -786,14 +783,14 @@ ColVis.prototype = { nHidden.style.top = iDivY+"px"; nHidden.style.left = iDivX+"px"; } + nHidden.style.display = "block"; + $(nHidden).css('opacity',0); - $(nHidden).css( { - 'display': 'block', - 'opacity': 0 - } ); + var iWinHeight = $(window).height(), iDocHeight = $(document).height(), + iWinWidth = $(window).width(), iDocWidth = $(document).width(); - nBackground.style.bottom ='0px'; - nBackground.style.right = '0px'; + nBackground.style.height = ((iWinHeight>iDocHeight)? iWinHeight : iDocHeight) +"px"; + nBackground.style.width = ((iWinWidth