Unknown error in DataTable
Unknown error in DataTable
DataTable v1.9.4
jQuery v1.8.2
When DataTable runs, it tried to process _fnStringToCss( s ) method and its fine until it eventually the value of 's' is reference to the actual table dom object. In this case it blows up on the line s.charCodeAt(s.length-1). Do you have any ideas why this is the case. I've included my datatable code below for reference.
Uncaught TypeError: Object [object Object] has no method 'charCodeAt'
[code]
$('#incentives-table').dataTable({
"sScrollY": "200px",
"bJQueryUI": true,
"bProcessing": true,
"bServerSide": true,
"bScrollCollapse": true,
"bSearchable" : false,
"bSort" : true,
"bFilter" : false,
"bInfo" : false,
"bPaginate" : false,
"sAjaxSource": '${contextPath}/app/incentivedetails.html',
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.ajax( {
dataType: 'json',
contentType: "application/json;charset=UTF-8",
type: 'POST',
url: sSource,
data: stringify_aoData(aoData),
success: fnCallback,
error : function (e) {
alert (e);
}
});
},
"aoColumnDefs": [
{ "aTargets": [0], "sName": "description", "sType": "string", "sWidth": "280px" },
{ "aTargets": [1], "sName": "incentiveType","sType": "string", "sWidth": "90px" },
{ "aTargets": [2], "sName": "amount", "sType": "numeric", "sWidth": "90px" },
{ "aTargets": [3], "sName": "startDate", "sType": "date", "sWidth": "90px" },
{ "aTargets": [4], "sName": "endDate", "sType": "date", "sWidth": "90px" },
{ "aTargets": [5], "sName": "suspended", "sType": "string",
"mRender": function(data, type, full) {
if ( data === true ) return 'Yes';
return 'No';
}
}
]
});
[/code]
jQuery v1.8.2
When DataTable runs, it tried to process _fnStringToCss( s ) method and its fine until it eventually the value of 's' is reference to the actual table dom object. In this case it blows up on the line s.charCodeAt(s.length-1). Do you have any ideas why this is the case. I've included my datatable code below for reference.
Uncaught TypeError: Object [object Object] has no method 'charCodeAt'
[code]
$('#incentives-table').dataTable({
"sScrollY": "200px",
"bJQueryUI": true,
"bProcessing": true,
"bServerSide": true,
"bScrollCollapse": true,
"bSearchable" : false,
"bSort" : true,
"bFilter" : false,
"bInfo" : false,
"bPaginate" : false,
"sAjaxSource": '${contextPath}/app/incentivedetails.html',
"fnServerData": function ( sSource, aoData, fnCallback ) {
$.ajax( {
dataType: 'json',
contentType: "application/json;charset=UTF-8",
type: 'POST',
url: sSource,
data: stringify_aoData(aoData),
success: fnCallback,
error : function (e) {
alert (e);
}
});
},
"aoColumnDefs": [
{ "aTargets": [0], "sName": "description", "sType": "string", "sWidth": "280px" },
{ "aTargets": [1], "sName": "incentiveType","sType": "string", "sWidth": "90px" },
{ "aTargets": [2], "sName": "amount", "sType": "numeric", "sWidth": "90px" },
{ "aTargets": [3], "sName": "startDate", "sType": "date", "sWidth": "90px" },
{ "aTargets": [4], "sName": "endDate", "sType": "date", "sWidth": "90px" },
{ "aTargets": [5], "sName": "suspended", "sType": "string",
"mRender": function(data, type, full) {
if ( data === true ) return 'Yes';
return 'No';
}
}
]
});
[/code]
This discussion has been closed.
Replies
Please link to a test case so we can say for certain what the issue is rather than just guessing.
Allan
Thanks for the insite. That is exactly what I found to be the problem. I had defined a column wrong in my json. the date i thought was coming back as a formatted string, but was being returned as a long value.