Column Sorting Error
Column Sorting Error
antivanity
Posts: 6Questions: 0Answers: 0
I get this error on all datatables iv made. It occurs when sorting a column, not sure whats going on. Please help ;)
ERROR:
oSettings.aoData[iRow] is undefined
[Break on this error] return oSettings.aoData[iRow]._aData;
CODE:
$(document).ready(function(){
myDataTable = $('#datatable').dataTable( {
"sPaginationType": "full_numbers"
});
$('#dataloader').hide();
$('#datatable tr').click( function(e) {
var position = myDataTable.fnGetPosition(this); // getting the clicked row position
var contactId = myDataTable.fnGetData(position)[0]; // getting the value of the first (invisible) column
document.location.href = "/account/view/" + contactId;
});
});
ERROR:
oSettings.aoData[iRow] is undefined
[Break on this error] return oSettings.aoData[iRow]._aData;
CODE:
$(document).ready(function(){
myDataTable = $('#datatable').dataTable( {
"sPaginationType": "full_numbers"
});
$('#dataloader').hide();
$('#datatable tr').click( function(e) {
var position = myDataTable.fnGetPosition(this); // getting the clicked row position
var contactId = myDataTable.fnGetData(position)[0]; // getting the value of the first (invisible) column
document.location.href = "/account/view/" + contactId;
});
});
This discussion has been closed.
Replies
$('#datatable tr').click( function(e) {
var position = myDataTable.fnGetPosition(this); // getting the clicked row position
if (position != null)
{
var contactId = myDataTable.fnGetData(position)[0]; // getting the value of the first (invisible) column
document.location.href = "/admin/useredit/" + contactId;
}
});
However, if it's now working as expected - that will do nicely ;-)
One thing to note, you might want to use '#datatable tbody tr' as your selector, as at the moment it will include the header row - which would return null from fnGetPosition().
Allan
Thanks allan!