diff --git a/js/core/core.sizing.js b/js/core/core.sizing.js index b90476628..dfc5fb00c 100644 --- a/js/core/core.sizing.js +++ b/js/core/core.sizing.js @@ -84,8 +84,11 @@ function _fnCalculateColumnWidths ( oSettings ) columnIdx = visibleColumns[i]; column = columns[ columnIdx ]; - $( _fnGetWidestNode( oSettings, columnIdx ) ) - .clone( false ) + var td = (column.sWidth && !column.bResizable) ? + $( '', {style: 'width='+column.sWidth+' !important;'} ) : + $( _fnGetWidestNode( oSettings, columnIdx ) ); + + td.clone( false ) .append( column.sContentPadding ) .appendTo( tr ); } @@ -94,7 +97,7 @@ function _fnCalculateColumnWidths ( oSettings ) // Table has been built, attach to the document so we can work with it tmpTable.appendTo( tableContainer ); - // When scrolling (X or Y) we want to set the width of the table as + // 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 ( scrollX && scrollXInner ) { diff --git a/js/model/model.column.js b/js/model/model.column.js index 7cc40c4ba..f1b4369f1 100644 --- a/js/model/model.column.js +++ b/js/model/model.column.js @@ -41,6 +41,13 @@ DataTable.models.oColumn = { */ "asSorting": null, + /** + * Flag to indicate if the column should allow resizing or not. + * If set false, then column size will only be calculated once. + * @type boolean + */ + "bResizable": true, + /** * Flag to indicate if the column is searchable, and thus should be included * in the filtering or not.