oSettings is null (Without AJAX SOURCE)
oSettings is null (Without AJAX SOURCE)
Hi everyone,
i'm using the datatable (simple row selection option & show/hide hidden row details) with mustache (js templating system), the table is filled when the mustache template is called (so content is already in the DOM), and then the datatable function is called (My entire website use AJAX Calls).
When i call for the first time this template part, there's no problem with all the features,
But when i replace the current template by another one, and come back to the datatable template, datatable works but not the show/hide hidden row details, when i click on it, console show :
TypeError: oSettings is null
jquery.datatable.js (line 5821) var aoOpenRows = oSettings.aoOpenRows;
Here's my code part :
[code]
oTable = $('#example').dataTable({
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
/* Append the grade to the default row class name */
if (aData[3])
{
$('td:eq(3)', nRow).html(XLiff('ui','STATE_'+aData[3]));
}
},
"bJQueryUI": true,
"aoColumnDefs": [
{
"mRender": function ( data, type, row ) {
return MyFormatMySqlDate(data);
},
"aTargets": [ 1 ]
},
{ "bVisible" : false, "aTargets" : [4,5,6,7]}
],
"bLengthChange": false,
"bScrollCollapse": true,
"bFilter": false,
"bDestroy": true
});
$('#example 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 = "/scripts/external/datatable/images/details_open.png";
oTable.fnClose( nTr );
}
else
{
/* Open this row */
this.src = "/scripts/external/datatable/images/details_close.png";
oTable.fnOpen( nTr, fnFormatDetails(oTable, nTr), 'details' );
}
} );
[/code]
With or without the bDestroy, it's the same thing... :(
I've tried some fnDestroy or reinitialisation method, args, it didn't work :/
Someone know what's the problem ?
Thanks,
Yeppao.
i'm using the datatable (simple row selection option & show/hide hidden row details) with mustache (js templating system), the table is filled when the mustache template is called (so content is already in the DOM), and then the datatable function is called (My entire website use AJAX Calls).
When i call for the first time this template part, there's no problem with all the features,
But when i replace the current template by another one, and come back to the datatable template, datatable works but not the show/hide hidden row details, when i click on it, console show :
TypeError: oSettings is null
jquery.datatable.js (line 5821) var aoOpenRows = oSettings.aoOpenRows;
Here's my code part :
[code]
oTable = $('#example').dataTable({
"fnRowCallback": function( nRow, aData, iDisplayIndex ) {
/* Append the grade to the default row class name */
if (aData[3])
{
$('td:eq(3)', nRow).html(XLiff('ui','STATE_'+aData[3]));
}
},
"bJQueryUI": true,
"aoColumnDefs": [
{
"mRender": function ( data, type, row ) {
return MyFormatMySqlDate(data);
},
"aTargets": [ 1 ]
},
{ "bVisible" : false, "aTargets" : [4,5,6,7]}
],
"bLengthChange": false,
"bScrollCollapse": true,
"bFilter": false,
"bDestroy": true
});
$('#example 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 = "/scripts/external/datatable/images/details_open.png";
oTable.fnClose( nTr );
}
else
{
/* Open this row */
this.src = "/scripts/external/datatable/images/details_close.png";
oTable.fnOpen( nTr, fnFormatDetails(oTable, nTr), 'details' );
}
} );
[/code]
With or without the bDestroy, it's the same thing... :(
I've tried some fnDestroy or reinitialisation method, args, it didn't work :/
Someone know what's the problem ?
Thanks,
Yeppao.
This discussion has been closed.
Replies
[code]
Change this :
$('#example tbody td img').live('click', function () {
In this :
$('#example tbody td img').die().live('click', function () {
[/code]