$('#example').dataTable(
{
"sScrollY": "200px",
}
$(window).resize( function () {
oTable.fnAdjustColumnSizing();
} );
Uncaught TypeError: Object [object Object] has no method 'fnAdjustColumnSizing'
g_dateResizeTables = new Date(Date.now() + 1000*60*60*24*365); // This variable is to determine when it is the time to resize the tables after the user is done resizing the browser window
$(window).resize(function()
{
g_dateResizeTables = new Date(Date.now().getTime() + 500); // Adjust the columns width when the user is idle, about 500ms later.
});
// This function is called every second, to perform updates on the UI
function OnTimer()
{
// Check if is time to resize the tables
if (Date.now() > g_dateResizeTables)
{
g_dateResizeTables = new Date(Date.now().getTime() + 1000*60*60*24*365);
$(".myDataTable").fnAdjustColumnSizing();
}
}
setInterval(OnTimer, 1000);
It appears the class selector for myDataTable does not return a table object.
$(".myDataTable").dataTable().fnAdjustColumnSizing();
DataTables warning (table id = 'myDataTable'): Cannot reinitialise DataTable.
To retrieve the DataTables object for this table, pass no arguments or see the docs for bRetrieve and bDestroy
$(".myDataTable").dataTable({'bRetrieve': true}).fnAdjustColumnSizing();I get the error
Uncaught TypeError: Cannot read property 'asSorting' of undefined
$("#myDataTable").dataTable().fnAdjustColumnSizing();
var a = $.fn.dataTableSettings;
for ( var i=0, iLen=a.length ; i<iLen ; i++ ) {
a[i].oInstance.fnAdjustColumnSizing();
}
allan said: At the moment it might be matching multiple tables with that selector.
<div class="dataTables_scroll">
<div class="dataTables_scrollHead">
<div class="dataTables_scrollHeadInner">
<table class="dataTable">
<thead>
<tr role="row">
<td class="ui-state-default"><div class="DataTables_sort_wrapper">Col 1<span class="DataTables_sort_icon"></span></div></td>
<td class="ui-state-default"><div class="DataTables_sort_wrapper">Col 2<span class="DataTables_sort_icon"></span></div></td>
</tr>
</thead>
</table>
</div>
</div>
<div class="dataTables_scrollBody">
<table id="THE_REAL_TABLE" class="dataTable"> <---- Here's my table
<thead>
<tr role="row" style="height: 0px; ">
<td class="ui-state-default"></td>
<td class="ui-state-default"></td>
</tr>
</thead>
<tbody role="alert" aria-live="polite" aria-relevant="all">
<tr class="odd"><td class=" sorting_1">Val 1</td><td class="">Val 2</td></tr>
<tr class="even"><td class=" sorting_1">Val 3</td><td class="">Val 4</td></tr>
</tbody>
</table>
</div>
</div>
table[id*="TABLE"]and named all my table with a similar ID.
It looks like you're new here. If you want to get involved, click one of these buttons!
Get useful and friendly help straight from the source.