oSettings is null - But this is almost exactly example code?

oSettings is null - But this is almost exactly example code?

snakalangsnakalang Posts: 2Questions: 0Answers: 0
edited October 2012 in Bug reports
Hi all, I might be seriously missing something here but the following code is almost exactly the same as the example code at http://datatables.net/release-datatables/examples/api/select_single_row.html but I'm getting oSettings is null at jquery.dataTables.js line 4979.

The code breaks when I try to do
[code]oTable.$('tr.row_selected').removeClass('row_selected');[/code]

I'm pretty sure sure I'm using the latest version of everything?
Here follows my full code, its very basic.

[code]
var oTable;
$(document).ready(function(){
$('#demo').html('');

$('#example').dataTable( {
"bPaginate": true,
"bLengthChange": false,
"bFilter": false,
"bSort": false,
"bInfo": false,
"bAutoWidth": false,
"bServerSide": false,

"aaData": [
/* Reduced data set */
[ "eng","English" , "This is a message" ],
[ "afr","Afrikaans" , "Hierdie is 'n boodskap" ],
],
"aoColumns": [
{ "sTitle": "Language code" },
{ "sTitle": "Language" },
{ "sTitle": "Display string" },
]
} );


/* Add a click handler to the rows - this could be used as a callback */
$("#example tbody tr").click( function( e ) {
if ( $(this).hasClass('row_selected') ) {
$(this).removeClass('row_selected');
}
else {
oTable.$('tr.row_selected').removeClass('row_selected');
$(this).addClass('row_selected');
}
});

oTable = $('example').dataTable();
});

/* Get the rows which are currently selected */
function fnGetSelected( oTableLocal )
{
return oTableLocal.$('tr.row_selected');
}
[/code]

Thanks

Replies

  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin
    edited October 2012
    Please give us a link to your page or at least use the debugger :-)

    Allan
  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin
    Actually - this is the problem:

    > oTable = $('example').dataTable();

    You are missing a hash at the start of `example` .

    Allan
  • snakalangsnakalang Posts: 2Questions: 0Answers: 0
    edited October 2012
    I'm a retard, thanks
This discussion has been closed.