Datatable data not clear
Datatable data not clear
Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem: when i click the page , we got the data and displayed using data tables, and then we have search functionality for specific record. by using search funtionality, i am able to pull the data and displayed, but when i click on the row,
$('#table_output tbody').on('click', 'td', function() {
console.log(table.cell(this).data());
// alert(JSON.stringify(table.cell(this).data()));
});
i am getting below error
Uncaught SyntaxError: "undefined" is not valid JSON
at JSON.parse (<anonymous>)
at ClientSelectEmail1 (itfwebJobs.js:122:22)
at HTMLTableRowElement.<anonymous> (ABATjobDetailsList:278:7)
at HTMLTableSectionElement.dispatch (jquery-3.5.1.js:5429:27)
at elemData.handle (jquery-3.5.1.js:5233:28)
but i vefied, i got the valid json only, i used the datatable. $('#table_output').DataTable().clear();, but its not clear, and verfied page source, it have all previsous records, mean not clear the datable data .
Please help me how resolve?
Replies
Its not clear what your code is doing and why you would get the
Uncaught SyntaxError: "undefined" is not valid JSON
error from the click event or usingclear()
. Please post a link to your page or a test case replicating the issue so we can help debug.https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin