After clearing filter input box, getting error Cannot use 'in' operator to search for 'length' in

After clearing filter input box, getting error Cannot use 'in' operator to search for 'length' in

shweta86shweta86 Posts: 0Questions: 1Answers: 0

I have HTML table rendered from REST data (spring, thymeleaf). on page load I am configuring HTML table to DataTable. Everything works fine except initial load with blank search I am getting an error,
'Cannot use 'in' operator to search for 'length' in' and also sorting not working.

If I put any text in search box, filter and sorting both works fine without throwing any error.

var table = $('#example').DataTable({
"serverSide": false,
"searching": true,
"order": [[ 0, "asc" ]],
"search": {
"text": "Filter",
"search": ""
},
"columnDefs": [
{ "searchable": true, "type":"display", "orderable": false, "targets": "classsid", "data": "security_id"
},
{ "searchable": false, "type":"display", "orderable": false, "targets": "classsread", "data": "read"
},
{ "searchable": false, "type":"display", "orderable": false, "targets": "classswrite", "data": "write"
},
{ "searchable": false, "type":"display", "orderable": false, "targets": "classsadmin", "data": "admin"
}
],
"dom": '<"#top.topClassI"f>rt<"#bottom.bottomClass"ipl><"clear">'
});

Answers

  • kthorngrenkthorngren Posts: 21,303Questions: 26Answers: 4,947

    A search of the forum indicates that the error could be due to older versions of Datatables with more recent versions of jQuery or issues with the JSON data returned. Sounds like you are building the HTML table then initializing Datatables.

    copying your code into a test case doesn't cause the issue you are seeing. Can you provide a link to a page showing the issue?

    Kevin

This discussion has been closed.