Uncaught TypeError: Cannot use 'in' operator to search for 'length' in Number Of Returned Files
Uncaught TypeError: Cannot use 'in' operator to search for 'length' in Number Of Returned Files
Hi,
I am trying to fetch data from a stored procedure in to data tables. For some reason its throwing this error.
Maybe I am doing something wrong.
$(document).ready(function () {
var mesa = $('.datatable').DataTable({
filename: "ReturnReportsCount",
responsive: true,
"bAutoWidth": false, // toggle this depending on how wide you want the table
"ajax": {
"url": "/ReturnedStructuredTgts/GetData",
"type": "GET",
"datatype": "json"
},
"deferRender": true,
"responsive": true,
dom: 'Bfrtip',
"bSort": false,
buttons: [
'excel', 'print'
],
"columns": [
"Number Of Returned Files",
"Percentage Of Returned Files"
]
Answers
Try calling the stored procedure by hand, and debugging there. It won't be an issue with DataTables, it'll be the SQL that you're calling.
Colin
Hi Colin,
"columns": [
"Number Of Returned Files",
"Percentage Of Returned Files"
]
Is this the right way to call columns? The stored procedure is working fine.
Thanks,
Minhal
Ah, yep,
columns
is very wrong. You need to declarecolumns.data
, and if that's a string you want in the title, usecolumns.title
,Colin
Hi Colin,
I tried in this way but it's still not working.
"columns": [
{ "data": "Number Of Returned Files" },
{ "data": "Percentage Of Returned Files" }
]
I have tried in this way as well
"columns": [
{ "title": "Number Of Returned Files" },
{ "title": "Percentage Of Returned Files" }
]
both the ways are not working for me at the moment.
Thanks,
Minhal
Can you post a sample of the JSON response from the browser's developer tools?
This technote will show you how.
We will need to see what is returned in order to help. Or you can use the Debugger and provide the code to the developers so they can take a look.
Kevin
Hi Kevin,
There is no error on the console window.
Thanks,
Minhal
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin