Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow user to specify static-width columns while bAutoWidth is enabled #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions js/core/core.sizing.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,11 @@ function _fnCalculateColumnWidths ( oSettings )
columnIdx = visibleColumns[i];
column = columns[ columnIdx ];

$( _fnGetWidestNode( oSettings, columnIdx ) )
.clone( false )
var td = (column.sWidth && !column.bResizable) ?
$( '<td />', {style: 'width='+column.sWidth+' !important;'} ) :
$( _fnGetWidestNode( oSettings, columnIdx ) );

td.clone( false )
.append( column.sContentPadding )
.appendTo( tr );
}
Expand All @@ -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 ) {
Expand Down
7 changes: 7 additions & 0 deletions js/model/model.column.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down