Has anyone encountered any errors after upgrading to the new version?

Has anyone encountered any errors after upgrading to the new version?

vfichrvfichr Posts: 5Questions: 1Answers: 0

Today, I downloaded the new version using the download builder, overwriting the old datatables.min.js and datatables.min.css files. My datatables are now unable to display data. I also tried the CDN version, but encountered the same problem.

console shows the errors:
Uncaught TypeError: Cannot read properties of undefined (reading 'extend')
at datatables.min.js:118:2421
at datatables.min.js:118:259
at datatables.min.js:118:279

Uncaught TypeError: Cannot read properties of undefined (reading 'display')
at HTMLDocument.<anonymous> (hoa-hong:2693:51)
at e (jquery.min.js?ver=3.7.1:2:27028)
at t (jquery.min.js?ver=3.7.1:2:27330)

jquery.min.js?ver=3.7.1:2 Uncaught TypeError: DataTable.render.select is not a function
at HTMLDocument.<anonymous> (hop-dong:8643:42)
at e (jquery.min.js?ver=3.7.1:2:27028)
at t (jquery.min.js?ver=3.7.1:2:27330)

New version includes:
* Included libraries:
* JSZip 3.10.1, pdfmake 0.2.7, DataTables 2.3.6, AutoFill 2.7.1, Buttons 3.2.6, Column visibility 3.2.6, HTML5 export 3.2.6, Print view 3.2.6, ColReorder 2.1.2, ColumnControl 1.2.0, DateTime 1.6.2, FixedColumns 5.0.5, FixedHeader 4.0.5, KeyTable 2.12.2, Responsive 3.0.7, RowGroup 1.6.0, RowReorder 1.5.0, Scroller 2.4.3, SearchPanes 2.3.5, Select 3.1.3, StateRestore 1.4.3
*/

Old version:
* Included libraries:
* JSZip 3.10.1, pdfmake 0.2.7, DataTables 2.3.5, AutoFill 2.7.1, Buttons 3.2.5, Column visibility 3.2.5, HTML5 export 3.2.5, Print view 3.2.5, ColReorder 2.1.2, ColumnControl 1.1.1, DateTime 1.6.1, FixedColumns 5.0.5, FixedHeader 4.0.5, KeyTable 2.12.2, Responsive 3.0.7, RowGroup 1.6.0, RowReorder 1.5.0, Scroller 2.4.3, SearchPanes 2.3.5, Select 3.1.3, StateRestore 1.4.3
*/

Replies

  • allanallan Posts: 65,481Questions: 1Answers: 10,876 Site admin

    It seems to work okay here. I think I've selected all the same packages as you have.

    Can you link to a test case showing the issue please?

    Thanks,
    Allan

  • kthorngrenkthorngren Posts: 22,386Questions: 26Answers: 5,141

    Looks like you are loading all the Datatables extensions. To reduce page size I would recommend only selecting/loading the extensions needed for the page.

    I used download builder to select the same options in this test case and it works without those errors.
    https://live.datatables.net/fepojaju/1/edit

    However it's a default Datatables initialization without things like render select, etc. Possibly there is a configuration you are using that is causing the errors. Can you provide a link to a test case with the errors so we can help debug? Possibly update my test case.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Also verify that only one instance of jquery.js and datatables and it's libraries are being loaded.

    Kevin

  • vfichrvfichr Posts: 5Questions: 1Answers: 0
    edited December 2025

    Thank you, the error was fixed by using Claude.
    WordPress runs jQuery in noConflict() mode, therefore the $ variable is not defined globally.
    DataTables 2.3.6 is trying to access $ (instead of jQuery), resulting in an undefined error.
    Claude added the line wp_add_inline_script('jquery', 'window.$ = window.jQuery;'); to ensure $ is assigned by jQuery right after jQuery loads.

  • allanallan Posts: 65,481Questions: 1Answers: 10,876 Site admin

    I'm afraid your gen-AI friend is wrong there, or that it has stumbled on an answer that works due to some other issue. DataTables 2.3.6 will work, no problem with noConflict() as can be seen in this example.

    Specifically, this is the line of code that is telling DataTables where to get the jQuery object - i.e. window.jQuery.

    My guess is that something else in your WordPress instance is loading another copy of jQuery.

    However, glad to hear that you've got it working now.

    Allan

  • lowegreglowegreg Posts: 1Questions: 0Answers: 0

    I had the same issue with the latest bundle. The real problem is inside the 2.3.6 DateTime module in my combined file.

    That block references $ directly, and the UMD wrapper for DateTime is called as s(window,document) (no jQuery param), so $ is expected to exist globally. In WordPress, $ is not global because of noConflict, so $ is undefined, which is exactly why my error is:

    Cannot read properties of undefined (reading 'extend')
    So it’s the DateTime module assuming $ exists globally in this bundle.

  • allanallan Posts: 65,481Questions: 1Answers: 10,876 Site admin
    edited December 2025

    That was it! Thank you for narrowing that down @lowegreg!

    I'm working on DataTables 3 at the moment, which does not require jQuery, and I managed to build the DateTime 1.6.2 release with the build scripts from DT3 - that resulted in the jQuery reference being removed from the UDM and $ being used, as seen.

    DateTime 1.6.3, which I've just released, fixes this error.

    Allan

Sign In or Register to comment.