Fixed column width management
Fixed column width management

Hello,
I'm currently using DataTables with Fixed Columns on my page. The first two columns are fixed to the left and the second one has values that range from 4 characters to 60-70 characters. I need the second fixed column width to be resize every redraw so that it will show the entire cell's contents. Any changes I make to aoColumnDefs, including at initialization, are not applied. I believe this is because FixedColumns uses iLeftWidth.
Does anyone know if there is a way to change iLeftWidth of fixedcolumns after the initial load? Any reliable method to control the column widths would be nice.
[code]
var oTable = $('#product_list').dataTable( {
"fnInitComplete": function() {
new FixedColumns(oTable, {
"iLeftColumns": 2
});
});
$('#reset_all').click(function() {
/* whatever code here should change the iLeftWidth value accomodate the longest table cell in the fixed columns */
});
[/code]
I'm currently using DataTables with Fixed Columns on my page. The first two columns are fixed to the left and the second one has values that range from 4 characters to 60-70 characters. I need the second fixed column width to be resize every redraw so that it will show the entire cell's contents. Any changes I make to aoColumnDefs, including at initialization, are not applied. I believe this is because FixedColumns uses iLeftWidth.
Does anyone know if there is a way to change iLeftWidth of fixedcolumns after the initial load? Any reliable method to control the column widths would be nice.
[code]
var oTable = $('#product_list').dataTable( {
"fnInitComplete": function() {
new FixedColumns(oTable, {
"iLeftColumns": 2
});
});
$('#reset_all').click(function() {
/* whatever code here should change the iLeftWidth value accomodate the longest table cell in the fixed columns */
});
[/code]
This discussion has been closed.
Replies
Allan
All of the documentation calls FixedColumns right after datatables is defined with:
[code]
new FixedColumns( oTable );
[/code]
Is there no way to call this after initialization? I was hoping I could have sometime like
[code]
$('#resize_fixed_columns').click(function() {
var oTable = $('body').data('oTable');
FixedColumns(oTable, {
"iLeftColumns":2,
"iLeftWidth":500
});
[/code]
Allan