Disabling Automatic column resizing?
Disabling Automatic column resizing?
Hello,
Fiirstly I'd like to say how impressed I am with DataTables, the functionality is amazing and is a perfect tool for my current project. However, I need a varying amount of columns (which I realise currently isn't really supported so I plan to rebuild the table every time the number of columns change).
I'm using the ColVIs plugin to let users decide what columns they want, but when a column is 'switched off' the rest increase in size to fill up the space left by the column that was just switched off. Is there any way to switch this off?
I'm using the FixedColumn to fix the left most column, and ideally I want the table to have an 'maximum width' and if the number of columns exceed the width, that portion of the table becomes scrollable in the x direction.
Here is my initialisation structure:
[code]
var colWidth = "100px";
var testTable = $("#TestTable").dataTable({
"bJQueryUI": true,
"bFilter": false,
"bPaginate": false,
"bAutoWidth": false,
"sDom": 'CR<"clear">t',
"sScrollX": "100%",
"sScrollXInner": "110%",
"bScrollCollapse": true,
"oColReorder": {
"iFixedColumns": 1
},
"aoColumns": [
{ "sWidth": "170px" },
{ "sWidth": colWidth },
{ "sWidth": colWidth },
{ "sWidth": colWidth },
{ "sWidth": colWidth },
{ "sWidth": colWidth },
{ "sWidth": colWidth },
{ "sWidth": colWidth },
{ "sWidth": colWidth }
],
"oColVis": {
"aiExclude": [0],
"sSize": "css",
"fnLabel": function (index, title, th) {
return $(th).data("colname");
}
}
});
[/code]
As you can see I tried the 'bAutoWidth' parameter but it didn't seem to do the trick, maybe its my sScrollX and sScrollXInner? I dont 100% understand these two params.
Fiirstly I'd like to say how impressed I am with DataTables, the functionality is amazing and is a perfect tool for my current project. However, I need a varying amount of columns (which I realise currently isn't really supported so I plan to rebuild the table every time the number of columns change).
I'm using the ColVIs plugin to let users decide what columns they want, but when a column is 'switched off' the rest increase in size to fill up the space left by the column that was just switched off. Is there any way to switch this off?
I'm using the FixedColumn to fix the left most column, and ideally I want the table to have an 'maximum width' and if the number of columns exceed the width, that portion of the table becomes scrollable in the x direction.
Here is my initialisation structure:
[code]
var colWidth = "100px";
var testTable = $("#TestTable").dataTable({
"bJQueryUI": true,
"bFilter": false,
"bPaginate": false,
"bAutoWidth": false,
"sDom": 'CR<"clear">t',
"sScrollX": "100%",
"sScrollXInner": "110%",
"bScrollCollapse": true,
"oColReorder": {
"iFixedColumns": 1
},
"aoColumns": [
{ "sWidth": "170px" },
{ "sWidth": colWidth },
{ "sWidth": colWidth },
{ "sWidth": colWidth },
{ "sWidth": colWidth },
{ "sWidth": colWidth },
{ "sWidth": colWidth },
{ "sWidth": colWidth },
{ "sWidth": colWidth }
],
"oColVis": {
"aiExclude": [0],
"sSize": "css",
"fnLabel": function (index, title, th) {
return $(th).data("colname");
}
}
});
[/code]
As you can see I tried the 'bAutoWidth' parameter but it didn't seem to do the trick, maybe its my sScrollX and sScrollXInner? I dont 100% understand these two params.
This discussion has been closed.