From 095d83e8c32060e10f46329891e1e5d96c75348b Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Fri, 31 Jan 2014 13:26:34 +0000 Subject: [PATCH] Dev fix: When x-scrolling, column widths were being overridden by the fact that the table width attribute has been removed, but was being applied to the table anyway, as 0px - causing the table to be as narrow as possible. On the plus size, the columns kept their alignment with such a misconfiguration! However, now the `width` option for columns is correctly applied in x-scrolling tables. --- .datatables-commit-sync | 2 +- media/js/jquery.dataTables.js | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.datatables-commit-sync b/.datatables-commit-sync index 04af78fc..86876abe 100644 --- a/.datatables-commit-sync +++ b/.datatables-commit-sync @@ -1 +1 @@ -316e736a56ffa6239de8ac64c2752ced55052d81 +5c8c9d9d6007da411cda657f833828ebdb9b33e2 diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index c72d9753..ab635b51 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -3948,16 +3948,16 @@ // allows the table sizing to automatically adjust when the window is // resized. Use the width attr rather than CSS, since we can't know if the // CSS is a relative value or absolute - DOM read is always px. - if ( tableWidthAttr || scrollX ) { + if ( tableWidthAttr ) { table.style.width = _fnStringToCss( tableWidthAttr ); + } - if ( ! oSettings._reszEvt ) { - $(window).bind('resize.DT-'+oSettings.sInstance, _fnThrottle( function () { - _fnAdjustColumnSizing( oSettings ); - } ) ); + if ( (tableWidthAttr || scrollX) && ! oSettings._reszEvt ) { + $(window).bind('resize.DT-'+oSettings.sInstance, _fnThrottle( function () { + _fnAdjustColumnSizing( oSettings ); + } ) ); - oSettings._reszEvt = true; - } + oSettings._reszEvt = true; } }