mirror of
https://github.com/DataTables/DataTables.git
synced 2024-12-10 22:24:10 +01:00
Performance: Read the style.width property for the restore width and
apply that. - This is much faster than the previous method of using $(this).width() since there is no longer an invalidation and getComputedStyle calculation. It just uses the value that is available in style.width, which might very well be empty (if the style attribute is used with a width property defined is it not empty). - This also improves accuracy since it is the original that is restored, and not the calculated size. - See http://datatables.net/forums/discussion/14811 for the discussion for this change. - Thanks to `krzycho` for the discussion and suggestions.
This commit is contained in:
parent
ad0e08585f
commit
b1d88c1c91
@ -559,11 +559,10 @@ this.fnDestroy = function ( bRemove )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restore the width of the original table */
|
/* Restore the width of the original table - was read from the style property,
|
||||||
if ( oSettings.oFeatures.bAutoWidth === true )
|
* so we can restore directly to that
|
||||||
{
|
*/
|
||||||
oSettings.nTable.style.width = _fnStringToCss(oSettings.sDestroyWidth);
|
oSettings.nTable.style.width = oSettings.sDestroyWidth;
|
||||||
}
|
|
||||||
|
|
||||||
/* If the were originally stripe classes - then we add them back here. Note
|
/* If the were originally stripe classes - then we add them back here. Note
|
||||||
* this is not fool proof (for example if not all rows had stripe classes - but
|
* this is not fool proof (for example if not all rows had stripe classes - but
|
||||||
|
@ -76,7 +76,7 @@ var oSettings = $.extend( true, {}, DataTable.models.oSettings, {
|
|||||||
"nTable": this,
|
"nTable": this,
|
||||||
"oApi": _that.oApi,
|
"oApi": _that.oApi,
|
||||||
"oInit": oInit,
|
"oInit": oInit,
|
||||||
"sDestroyWidth": $(this).width(),
|
"sDestroyWidth": $(this)[0].style.width,
|
||||||
"sInstance": sId,
|
"sInstance": sId,
|
||||||
"sTableId": sId
|
"sTableId": sId
|
||||||
} );
|
} );
|
||||||
|
Loading…
Reference in New Issue
Block a user