How do you auto-resize the columns after show/hide in IE8?

How do you auto-resize the columns after show/hide in IE8?

cseigelcseigel Posts: 4Questions: 0Answers: 0
edited April 2013 in General
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]

Replies

  • cseigelcseigel Posts: 4Questions: 0Answers: 0
    Just incase more detail about my problem is needed:

    - 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]
This discussion has been closed.