1
0
mirror of https://github.com/DataTables/DataTables.git synced 2025-03-15 16:29:16 +01:00

New: Support for box-sizing: border-box;

- Setting `box-sizing: border-box;` for table cells would cause
  DataTables to incorrectly calculate the size of the element when
  applying the scrolling draw. This is because jQuery's $().width()
  always returns the content width (taking into account box-sizing).

- One possible fix was to detect the box model used and switch between
  width() and outerWidth(), but a much better fix is to use
  $().css('width') as this does take into account the box-model and
  allows DataTables to draw the scrolling table columns correctly,
  regardless of the box model. It should actually also improve
  performance, since jQuery doesn't need to look the box model up
  itself.

- This fixes issue #157
This commit is contained in:
Allan Jardine 2013-06-21 09:45:29 +01:00
parent 370a1e7f7a
commit 95be4568eb

View File

@ -318,7 +318,7 @@ function _fnScrollDraw ( o )
// Read all widths in next pass. Forces layout only once because we do not change
// any DOM properties.
_fnApplyToChildren( function(nSizer) {
aApplied.push( _fnStringToCss( $(nSizer).width() ) );
aApplied.push( _fnStringToCss( $(nSizer).css('width') ) );
}, anHeadSizers );
// Apply all widths in final pass. Invalidates layout only once because we do not
@ -335,7 +335,7 @@ function _fnScrollDraw ( o )
_fnApplyToChildren( zeroOut, anFootSizers );
_fnApplyToChildren( function(nSizer) {
aAppliedFooter.push( _fnStringToCss( $(nSizer).width() ) );
aAppliedFooter.push( _fnStringToCss( $(nSizer).css('width') ) );
}, anFootSizers );
_fnApplyToChildren( function(nToSize, i) {