The unzipped js file does not work
The unzipped js file does not work
Link to test case: https://github.com/ChuckTest/DataTablesTest/commit/34aa9389dfdf9e8b4fa9279e7b71e06643eaf577
Debugger code (debug.datatables.net):
Error messages shown: DataTables warning: table id=example - Requested unknown parameter '11' for row 0, column 11. For more information about this error, please see https://datatables.net/tn/4
Description of problem:
I download the files from this link
https://datatables.net/download/#bs4/jszip-3.10.1/pdfmake-0.2.7/dt-1.13.8/af-2.6.0/b-2.4.2/b-colvis-2.4.2/b-html5-2.4.2/b-print-2.4.2/date-1.5.1/r-2.5.0
unzip it and uploaded to https://github.com/ChuckTest/DataTablesTest/tree/34aa9389dfdf9e8b4fa9279e7b71e06643eaf577/DataTables-2023-1205-001
then I reference the js file, and load the data on index.html page, got the above error
This question has accepted answers - jump to:
Answers
also tried with cdn files , still same error
but when I replace the js file with //cdn.datatables.net/1.13.7/js/jquery.dataTables.min.js
the popup error disappeared
Could you check if there is something wrong with js files provided via https://datatables.net/download/, especially concatenated js files
also tried another simple cdn concatenated js fiels, only bootstrap4 with datatables
<link href="https://cdn.datatables.net/v/bs4/dt-1.13.8/datatables.min.css" rel="stylesheet">
<script src="https://cdn.datatables.net/v/bs4/dt-1.13.8/datatables.min.js"></script>
This version works fine, will not popup errors. But it's not the version I wanted
In column 11 you have this:
Since you are using
columns.data
to define the other columns try usingdata: null
, like this:Kevin
Hi @kthorngren ,
Thanks, it works with your suggestion.
1.But why without
data: null
, it works fine with cdn.datatables.net/1.13.7/js/jquery.dataTables.min.js?2.and without
data: null
, the following solution also can suppress the above error messagehttps://stackoverflow.com/questions/16539578/datatables-warning-requested-unknown-parameter-0-from-the-data-source-for-rowIt shouldn't. If it did, it was a bug.
Allan
Hi @allan,
You may check this version https://github.com/ChuckTest/DataTablesTest/tree/31f7a8b13c7a5f898dcd3ecc775fa525d78ad38e
Reference the js and css from cdn as following:
Without
data:null
, error message should popup with you said. But there is no error message popup.(By the way, even if we have the error message popup in previous sample, the table loaded the data correctly )There is nothing in that example that is asking for the raw, unrendered data. Therefore no warning is issued.
It does happen in the first post because Responsive is being used. Responsive is requesting the unrendered data, and therefore it can't be resolved and the warning is issued.
The upshot is, no bug, and the behaviour didn't change between versions.
I would suggest you should always set
columns.data
if you are usingcolumns.render
as well. It will default to the column index, which is of no use when you have objects for the data source objects as you do here.Allan
Hi @allan,
Thanks, the issue was triggered by the responsive extension, it make senses. Suggestion is, maybe we can have different popup message, otherwise it will make user confused.
I think the error is actually correct - the column was configured (in its default state) to access data from array index 11. It couldn't and threw an error.
I agree that there could be a more nuanced message, but I don't want to have loads of if conditions to guard against misconfiguration. That would increase the size of the library and only be useful during development.
I had often wondered about doing a "debug" version of DataTables that would include such guards, and maybe one day I'll do that!
Great to hear that it is resolved for you now though.
Allan
Hi @allan,
Thanks for your patience. Yeah, from the end user side, it does not make a difference. Only the developer who is using the datatables cares about such kin of issues.
I have filed another two issue, mostly affect the developers who used the datatables plugin
https://datatables.net/forums/discussion/77779/popup-error-message-or-write-console-log-when-fetch-data-failed
https://datatables.net/forums/discussion/77780/popup-error-message-or-write-console-log-when-visiblecolumns-length-does-not-match-headercells
Both of them can improve the experience of the developer, make it easier to do the troubleshooting