mirror of
https://github.com/DataTables/DataTables.git
synced 2025-03-15 16:29:16 +01:00
Fix #162 - Flexible width is width="100%" is applied as attribute to the HTML table
- Attach an event handler to the window to resize the table. Note that this isn't debounced - possibly it should be in future(?), but don't want to add the additional code required if it isn't required. It seems to function perfectly well for me! - Unbind needs to unbind by the instance unique reference since there might be multiple tables listening for the event.
This commit is contained in:
parent
25eaa86477
commit
b87187fc5b
@ -494,6 +494,7 @@ this.fnDestroy = function ( bRemove )
|
|||||||
|
|
||||||
/* Blitz all DT events */
|
/* Blitz all DT events */
|
||||||
$(oSettings.nTableWrapper).unbind('.DT').find('*').unbind('.DT');
|
$(oSettings.nTableWrapper).unbind('.DT').find('*').unbind('.DT');
|
||||||
|
$(window).unbind('.DT-'+oSettings.sInstance);
|
||||||
|
|
||||||
/* If there is an 'empty' indicator row, remove it */
|
/* If there is an 'empty' indicator row, remove it */
|
||||||
$('tbody>tr>td.'+oSettings.oClasses.sRowEmpty, oSettings.nTable).parent().remove();
|
$('tbody>tr>td.'+oSettings.oClasses.sRowEmpty, oSettings.nTable).parent().remove();
|
||||||
|
@ -249,6 +249,15 @@ function _fnCalculateColumnWidths ( oSettings )
|
|||||||
if ( widthAttr )
|
if ( widthAttr )
|
||||||
{
|
{
|
||||||
oSettings.nTable.style.width = _fnStringToCss( widthAttr );
|
oSettings.nTable.style.width = _fnStringToCss( widthAttr );
|
||||||
|
|
||||||
|
if ( ! oSettings._attachedResizing &&
|
||||||
|
(oSettings.oScroll.sY !== '' || oSettings.oScroll.sX !== '') )
|
||||||
|
{
|
||||||
|
$(window).bind('resize.DT-'+oSettings.sInstance, function () {
|
||||||
|
_fnScrollDraw( oSettings );
|
||||||
|
} );
|
||||||
|
oSettings._attachedResizing = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user