From 505bfce7c260d70fd2944c96385f571f030bc0b4 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Sat, 21 Aug 2010 10:05:07 +0100 Subject: [PATCH] Fixed: The width of the table is now not fixed to the width of the container when scrolling is not applied (this is the same behaviour as 1.6-) - 2530 --- examples/basic_init/zero_config.html | 2 +- media/js/jquery.dataTables.js | 6 +++++- media/unit_testing/tests_onhold/1_dom/2530-2.js | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100755 media/unit_testing/tests_onhold/1_dom/2530-2.js diff --git a/examples/basic_init/zero_config.html b/examples/basic_init/zero_config.html index 26f84812..e7eda320 100644 --- a/examples/basic_init/zero_config.html +++ b/examples/basic_init/zero_config.html @@ -28,7 +28,7 @@

Live example

- +
diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index 66b297bb..b3341e2f 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -5135,6 +5135,10 @@ var nWrapper = oSettings.nTable.parentNode; nWrapper.appendChild( nCalcTmp ); + /* When scrolling (X or Y) we want to set the width of the table as appropriate. However, + * when not scrolling leave the table width as it is. This results in slightly different, + * but I think correct behaviour + */ if ( oSettings.oScroll.sX !== "" && oSettings.oScroll.sXInner !== "" ) { nCalcTmp.style.width = _fnStringToCss(oSettings.oScroll.sXInner); @@ -5147,7 +5151,7 @@ nCalcTmp.style.width = _fnStringToCss( nWrapper.offsetWidth ); } } - else + else if ( oSettings.oScroll.sY !== "" ) { nCalcTmp.style.width = _fnStringToCss( nWrapper.offsetWidth ); } diff --git a/media/unit_testing/tests_onhold/1_dom/2530-2.js b/media/unit_testing/tests_onhold/1_dom/2530-2.js new file mode 100755 index 00000000..cba8cf81 --- /dev/null +++ b/media/unit_testing/tests_onhold/1_dom/2530-2.js @@ -0,0 +1,15 @@ +// DATA_TEMPLATE: dom_data +oTest.fnStart( "User given with is left when no scrolling" ); + +$(document).ready( function () { + $('#example')[0].style.width = "80%"; + $('#example').dataTable(); + + oTest.fnTest( + "Check user width is left", + null, + function () { return $('#example').width() == 640; } + ); + + oTest.fnComplete(); +} ); \ No newline at end of file
Rendering engine