Row created callback (custom jQuery) causes issues
-
I am adding classes to my table cells based on values using the simple script below. It works and adds the classes as expected. However, I get the following error notice: “DataTables warning: table id=tablepress-1 – Cannot reinitialise DataTable.”
I’m using code suggested by the DataTables docs, so nothing out of the ordinary:
$('#tablepress-1').DataTable({ createdRow: function (row, data, index) { if (data[3].replace(/[$*%]/g, '') < 0) { $('td', row).eq(3).addClass( 'highlight' ); } if (data[3].replace(/[$*%]/g, '') >= 0) { $('td', row).eq(3).addClass( 'lowlight' ); } }, });
I can prevent this by adding
"retrieve": true
to the Custom Commands in TablePress, but there are still issues if I do. Things like the “Previous” and “Next” buttons do not work, and most importantly the Responsive Plugin (which I donated to support ?? ) doesn’t work.Am I adding this custom script incorrectly or doing something else wrong? I scoured the documentation but didn’t see anything unfortunately.
- The topic ‘Row created callback (custom jQuery) causes issues’ is closed to new replies.