How can I change sScrollXInner after initialization
How can I change sScrollXInner after initialization
I am updating the number of columns in my table dynamically. I have a fixed left column and the rest are scrolling and I want the columns to each be a fixed 140 columns. I'm able to set the initial sScrollXInner and it works great, but after I dynamically update the number of columns with different data, I'm not sure how to update the sScrollXInner with the new width. Is there a way to update just that value without having to destroy and recreate the entire thing?
[code]
var modsTableCount = 0;
$('#dispModuleTableTBody tr:nth-child(1) th').each(function () { modsTableCount++; });
var modulesTable = $('#dispModuleTable').dataTable( {
"sScrollY": "100%",
"sScrollX": "100%",
"sScrollXInner": ((modsTableCount - 1) * 140),
"bScrollCollapse": false,
"bPaginate":false,
"bSort":false,
"bFilter":false,
"bAutoWidth":false,
"bInfo":false
} );
new FixedColumns( modulesTable, {
"iLeftWidth": 140
} );
[/code]
[code]
var modsTableCount = 0;
$('#dispModuleTableTBody tr:nth-child(1) th').each(function () { modsTableCount++; });
var modulesTable = $('#dispModuleTable').dataTable( {
"sScrollY": "100%",
"sScrollX": "100%",
"sScrollXInner": ((modsTableCount - 1) * 140),
"bScrollCollapse": false,
"bPaginate":false,
"bSort":false,
"bFilter":false,
"bAutoWidth":false,
"bInfo":false
} );
new FixedColumns( modulesTable, {
"iLeftWidth": 140
} );
[/code]
This discussion has been closed.
Replies
Without it, DataTables will scroll as much as needed.
Allan
There might be an easier way though. If so... I would appreciate it if someone could enlighten me.
Allan