Uncaught TypeError: Cannot read property 'splice' of undefined
Uncaught TypeError: Cannot read property 'splice' of undefined
bhatt_axay
Posts: 46Questions: 12Answers: 3
What this error means? It occur while my data is fetching from the database to dataTable. I am using pipeling concept of dataTable.
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Per the forum rules, please link to a test case showing the issue so it can be debugged.
Allan
'<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
};
</head>
<body class="dt-example">
</body>
</html>'
In above code i got the error on 'line no.98:json.data.splice( requestLength, json.data.length );'
It show me
'Uncaught TypeError: Cannot read property 'splice' of undefined'
That suggests that there is no
data
array in the returned JSON. However, without a link to the page, as I requested above, I can't say for sure.Allan
But I am working on a localhost how can i give you link?
It returns me 'http://localhost/datatable/server-response.php?length=NaN&_=1453290385040'
You would need to use JSFiddle, CodePen or similar to built a working test case if you cannot host it yourself.
Allan
Uncaught ReferenceError: drawStart is not defined
settings.jqXHR.$.ajax.success index.php:90
jquery.js:2k.fireWith
jquery.js:2x
jquery.js:5b
jquery.js:5
What the above error means?
Okk Thanks I got it
But still my json array is not display in the datatable from the database
It returns me in console log like: length=Nan&_=1453369326998
As I mentioned three times above we would need a test case showing the issue in order to be able to offer any help.
https://jsfiddle.net/bhatt_axay/8a1qbb27/
But i cannot upload my server-response.php file on jsfiddle
You can use the
/echo/json
feature of JSFiddle to simulate it: http://doc.jsfiddle.net/use/echo.html .Allan
Please check it: http://live.datatables.net/vasixume/1/
http://live.datatables.net/vasixume/1/edit
Hello,
I got my data in my datatable but other features of datatable not working like pagination,searching.
My data-table doesn't show me bInfo, search and pagination features of datatable still my data is present in datatable.
Here is the code.
'<meta name = "viewport" content = "width = device-width, initial-scale = 1">
<link rel="stylesheet" type="text/css" href="css/jquery.dataTables.css">
src="js/jquery.dataTables.js"></script>
cacheLastRequest.order ) ||
JSON.stringify( request.columns ) !== JSON.stringify( cacheLastRequest.columns ) ||
JSON.stringify( request.search ) !== JSON.stringify( cacheLastRequest.search )
) {
};
$.fn.dataTable.Api.register( 'clearPipeline()', function () {
} );
$(document).ready(function() {
$('#employeeListing').DataTable( {
} );
</script>
</head>
<body>
</body>'
</html>
Hello,
I got my data in my data-table but the inbuilt functionality of table not working like paging, searching, bInfo
Hello,
My json array response is in a string format and datatable accept integer value as an index value of an array. Now when i use fetch_array() than it returns me both array value like:
E.g:
{"aaData":[{"0":"abc","fullname":"abc","1":"abc@gmail.com","user_name":"abc@gmail.com","2":"74653696","phnumber":"74653696","3":"xyz","address":"xyz"}]}
Hello,
I resolve my problem of getting json array error using aColumns :[{ aMdata:"fullname", "aTargets" : [0] }]
Thanks
But still my datatable inbuilt features not working like searching, sorting, bInfo etc
I think you might have opened a new thread about this. Is that correct?
I'm sorry if I wasn't clear before - but without a test case showing the issue I cannot and will not debug this.
Allan
The solution to this problem is to change json.data to json.[name of your data array]. like in my case, my data array from server-side is aaData, therefore i changed json.data to json.aaData it worked pretty fine.