Error: table.fnSettings() is null
Error: table.fnSettings() is null
Hi
the first time i click the menuentry to get to my datatable page i can select my datatable entries without any problem.
Whenever i click on the menuitem again or another menuitem which loads another table into the content i get this error whenever i click on a datatable entry Error: table.fnSettings() is null. When i reload the page however everything is fine again.
[code]
var table = $('#example').dataTable({
"bJQueryUI": true,
"sScrollY" : "200px",
"aaSorting" : [ [ 1, 'asc' ] ],
"sPaginationType": "full_numbers"
});
// SELECTION OF ROWS
$("tr", table).live("click", function (event) {
if ($(event.target.parentNode).hasClass('selectedDataTableRow')) {
$(event.target.parentNode).removeClass('selectedDataTableRow');
$("#editTutorButton").button("disable");
$("#deleteTutorButton").button("disable");
} else {
$(table.fnSettings().aoData).each(function () {
$(this.nTr).removeClass('selectedDataTableRow');
});
$(event.target.parentNode).addClass('selectedDataTableRow');
$("#editTutorButton").button("enable");
$("#deleteTutorButton").button("enable");
}
});
[/code]
What seems to be the problem here?
greez
the first time i click the menuentry to get to my datatable page i can select my datatable entries without any problem.
Whenever i click on the menuitem again or another menuitem which loads another table into the content i get this error whenever i click on a datatable entry Error: table.fnSettings() is null. When i reload the page however everything is fine again.
[code]
var table = $('#example').dataTable({
"bJQueryUI": true,
"sScrollY" : "200px",
"aaSorting" : [ [ 1, 'asc' ] ],
"sPaginationType": "full_numbers"
});
// SELECTION OF ROWS
$("tr", table).live("click", function (event) {
if ($(event.target.parentNode).hasClass('selectedDataTableRow')) {
$(event.target.parentNode).removeClass('selectedDataTableRow');
$("#editTutorButton").button("disable");
$("#deleteTutorButton").button("disable");
} else {
$(table.fnSettings().aoData).each(function () {
$(this.nTr).removeClass('selectedDataTableRow');
});
$(event.target.parentNode).addClass('selectedDataTableRow');
$("#editTutorButton").button("enable");
$("#deleteTutorButton").button("enable");
}
});
[/code]
What seems to be the problem here?
greez
This discussion has been closed.
Replies
Other than that - it looks good to me - so hopefully that will do it!
Allan
It is selectable again but it still doesnt make the error message of the else go away. table.fnSettings() is still null..
There is a solution like this:
$("#example tbody").click(function(event) {
$(table.fnSettings().aoData).each(function (){
$(this.nTr).removeClass('selectedDataTableRow');
});
$(event.target.parentNode).addClass('selectedDataTableRow');
$("#editTutorButton").button("enable");
$("#deleteTutorButton").button("enable");
});
But i still dont understand why the other solution does not work..
Allan