How do you auto-resize the columns after show/hide in IE8?
How do you auto-resize the columns after show/hide in IE8?
In the current version of Datatables is it possible to auto-resize columns after show/hideing them with the API?
My question is specifically for IE8, for firefox fnAdjustColumnSizing() seems to work.
For my specific case here are some details incase it helps:
-The column widths are not specified at all in the html
-Data is added using fnAddData()
-Columns are hidden/shown using fnSetColumnVis()
-The following is my table initialization:
[code]
Roster.oTable = $('#rosterTable').dataTable({
"bJQueryUI": true,
"sScrollY": "300px",
"bScrollCollapse": true,
"bPaginate": false,
"sDom": 'T<"clear"><"fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix"lfr>t<"fg-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix"ip>', //(required for table tools to show up)
"oTableTools": {
"sSwfPath": "../DataTables-1.9.4/extras/TableTools/media/swf/copy_csv_xls_pdf.swf",
"aButtons": [
"copy",
{
"sExtends": "print",
"fnComplete": function ( nButton, oConfig, oFlash, sFlash ){
Roster.ToggleNonTableVisibility();
return false;
},
"sMessage": "Return to " + Common.APP_TITLE + ""
},
{
"sExtends": "collection","sButtonText": "Save",
"aButtons": ["csv", "xls", "pdf"],
}
]
}
});
[/code]
My question is specifically for IE8, for firefox fnAdjustColumnSizing() seems to work.
For my specific case here are some details incase it helps:
-The column widths are not specified at all in the html
-Data is added using fnAddData()
-Columns are hidden/shown using fnSetColumnVis()
-The following is my table initialization:
[code]
Roster.oTable = $('#rosterTable').dataTable({
"bJQueryUI": true,
"sScrollY": "300px",
"bScrollCollapse": true,
"bPaginate": false,
"sDom": 'T<"clear"><"fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix"lfr>t<"fg-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix"ip>', //(required for table tools to show up)
"oTableTools": {
"sSwfPath": "../DataTables-1.9.4/extras/TableTools/media/swf/copy_csv_xls_pdf.swf",
"aButtons": [
"copy",
{
"sExtends": "print",
"fnComplete": function ( nButton, oConfig, oFlash, sFlash ){
Roster.ToggleNonTableVisibility();
return false;
},
"sMessage": "Return to " + Common.APP_TITLE + ""
},
{
"sExtends": "collection","sButtonText": "Save",
"aButtons": ["csv", "xls", "pdf"],
}
]
}
});
[/code]
This discussion has been closed.
Replies
- Note that there is large white space after a column is hidden, and not even restored when the column is restored.
-My table is inside a jquery UI tab
-My tab is initialized like this:
[code]
$("#tabs").tabs(
{
"show": function(event, ui) {
var jqTable = $('table.display', ui.panel);
if ( jqTable.length > 0 ) {
var oTableTools = TableTools.fnGetInstance( jqTable[0] );
if ( oTableTools != null && oTableTools.fnResizeRequired() )
{
/* A resize of TableTools' buttons and DataTables' columns is only required on the
* first visible draw of the table
*/
jqTable.dataTable().fnAdjustColumnSizing();
oTableTools.fnResizeButtons();
}
}
}
}
);
[/code]