Order column not working when load data via ajax
Order column not working when load data via ajax
Description of problem:
When clicking on the order arrow on any column of the table, the error appears this error
Error messages shown:
Uncaught TypeError: can't assign to property "length" on 1: not an object
Code:
idTable = $('#tbl-id').DataTable({
lengthMenu: [ 5,10,20 ],
ajax:{
url:"/tbl-id",
type:"POST",
dataSrc:function(json){
return json.data;
}
})
Answers
It's working fine here. 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