Hi all, being a newbie to datatables I'm having a problem.
My table is being opened and filled depending on which link one clicks. The first time there's no problem with opening/closing the rows to show detailed info. But after clicking the other link. opening/closing the rows doesn't function anymore.
Instead I'm getting an Exception : "TypeError: oSettings is null" in:
this.fnIsOpen = function( nTr )
{
var oSettings = _fnSettingsFromNode( this[DataTable.ext.iApiIndex] );
var aoOpenRows = oSettings.aoOpenRows;
......
Anyone any ideas how to solve this one?
kind regards Auke Poortman
This is my code:
var str="";
var oTable;
/* Formating function for row details */
function fnFormatDetails ( nTr )
{
var aData = oTable.fnGetData(nTr);
var sOut = '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">';
sOut += '<tr><td>Filesize:</td><td>' + aData.filesize + '</td></tr>';
sOut += '<tr><td>runbatchID:</td><td>' + aData.runbatchID + '</td></tr>';
sOut += '<tr><td>Starttijd verwerking:</td><td>' + aData.starttijdBatch + '</td></tr>';
sOut += '<tr><td>Eindtijd verwerking:</td><td>' + aData.eindtijdBatch + '</td></tr>';
sOut += '<tr><td>Duur verwerking:</td><td>' + aData.eindtijdBatch + '</td></tr>';
sOut += '</table>';
return sOut;
}
$(document).ready(function() {
oTable =$('#datatable').dataTable( {
"bProcessing": true,
"bStateSave": true,
"bServerSide": true,
"bFilter": false,
"bLengthChange": true,
"bRetrieve": true,
"aaSorting": [[ 1, "desc" ]],
"fnServerParams": function ( aoData ) {
aoData.push( { "name": "env",
"value": "<?php print($_GET['env']); ?>" } );
aoData.push( { "name": "customer",
"value": $("#filter_customer").mcDropdown().getValue()[0] } );
aoData.push( { "name": "filename",
"value": document.getElementById('filter_filename').value } );
aoData.push( { "name": "filter_start",
"value": document.getElementById('filter_start').value } );
aoData.push( { "name": "filter_finish",
"value": document.getElementById('filter_finish').value } );
},
"sAjaxSource": "AJAX/datatables/Postbus_data.php",
"aoColumns": [
{ "mDataProp": "details_png", "bSortable": false },
{ "mDataProp": "date", "bSortable": true },
{ "mDataProp": "time", "bSortable": false },
{ "mDataProp": "customer", "bSortable": true },
{ "mDataProp": "filename", "bSortable": true },
{ "mDataProp": "filesize", "bSortable": true, "bVisible": false },
{ "mDataProp": "transferstatus", "bSortable": true },
{ "mDataProp": "runbatchID", "bSortable": true, "bVisible": false },
{ "mDataProp": "starttijdBatch", "bSortable": true, "bVisible": false },
{ "mDataProp": "eindtijdBatch", "bSortable": true, "bVisible": false },
{ "mDataProp": "batchstatus", "bSortable": true }
]
} );
$('#datatable tbody td img').live( 'click', function () {
var nTr = $(this).parents('tr')[0];
if ( oTable.fnIsOpen(nTr ) )
{
/* This row is already open - close it */
this.src = "css/images/datatables/details_open.png";
oTable.fnClose( nTr );
}
else
{
/* Open this row */
this.src = "css/images/datatables/details_close.png";
oTable.fnOpen( nTr, fnFormatDetails(nTr), 'details' );
}
});
} );