Error on my dataTable: "Cannot read property 'unique' of undefined "

Error on my dataTable: "Cannot read property 'unique' of undefined "

adromiladromil Posts: 53Questions: 4Answers: 0
edited July 2012 in General
I have two(2) tables using jQuery dataTables plug-in, I cannot sort the 2nd table. I was debugging my code and check the debug tool of google chrome on the console tab this is the error I saw : Cannot read property 'unique' of undefined .

my javascript code goes like this:
[code]

var oTable;
var rTable;
jQuery.fn.dataTableExt.oSort['numeric-comma-asc'] = function(a,b) {
var x = (a == "-") ? 0 : a.replace( /,/g, "" );
var y = (b == "-") ? 0 : b.replace( /,/g, "" );
x = parseFloat( x );
y = parseFloat( y );
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
};
jQuery.fn.dataTableExt.oSort['numeric-comma-desc'] = function(a,b) {
var x = (a == "-") ? 0 : a.replace( /,/g, "" );
var y = (b == "-") ? 0 : b.replace( /,/g, "" );
x = parseFloat( x );
y = parseFloat( y );
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
};

$(document).ready(function() {
oTable = $('#tblrpt').dataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bInfo": false,
"bAutoWidth": false,
"bSort": true,
"aoColumnDefs": [
// {"bVisible": false, "aTargets": [ 8 ]},
// {"bVisible": false, "aTargets": [ 9 ]},
// {"bVisible": false, "aTargets": [ 10 ]},
// {"bVisible": false, "aTargets": [ 11 ]},
// {"bVisible": false, "aTargets": [ 12 ]},
// {"bVisible": false, "aTargets": [ 13 ]},
{ "sType": "numeric-comma", "aTargets": [ 3 ] },
{ "sType": "numeric-comma", "aTargets": [ 5 ] },
{ "sType": "numeric-comma", "aTargets": [ 6 ] }
]
});
rTable = $('#tblret').dataTable({
"bPaginate": false,
"bLengthChange": false,
"bFilter": false,
"bInfo": false,
"bAutoWidth": false,
"bSort": true,
"aoColumnDefs": [
// {"bVisible": false, "aTargets": [ 8 ]},
// {"bVisible": false, "aTargets": [ 9 ]},
// {"bVisible": false, "aTargets": [ 10 ]},
// {"bVisible": false, "aTargets": [ 11 ]},
// {"bVisible": false, "aTargets": [ 12 ]},
// {"bVisible": false, "aTargets": [ 13 ]},
{ "sType": "numeric-comma", "aTargets": [ 4 ] },
{ "sType": "numeric-comma", "aTargets": [ 5 ] }
]
});
});

[/code]
Anyone who can give me inputs to resolve this.

Thank you in advanced.

Replies

  • allanallan Posts: 63,133Questions: 1Answers: 10,399 Site admin
    http://datatables.net/faqs#unknown_parameter :-)

    Allan
This discussion has been closed.