Datatable is coming undefined, earlier it was working fine but suddenly it stopped

Datatable is coming undefined, earlier it was working fine but suddenly it stopped

tanishqbiswastanishqbiswas Posts: 4Questions: 1Answers: 0

this is how we are initializing the datatables, currently using datatable version 1.10.21 and jquery v3.6.2

this.elm.dataTable = this.elm.$table.DataTable({
                paging: false,
                searching: false,
                ordering: false,
                scrollX: false,
                info: false,
                bAutoWidth : false,
                fixedHeader: {
                    header: true,
                    footer: false
                },
                responsive: {
                    details: true
                },
                columnDefs: [
                    { targets: this.visibleColumnIndexes, visible: true},
                    { targets: '_all', visible: false }
                ]
            });

error: multiple issue is getting occurred, things are coming undefined.

Uncaught TypeError: Cannot read properties of undefined (reading 'column')
Uncaught TypeError: Cannot read properties of undefined (reading 'fixedHeader')
Uncaught (in promise) Warning: FixedHeader requires DataTables 2 or newer

as mentioned in last warning it is referencing to version 2 or latest but before fixedheader was working fine with version 1.10.21.

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    If you could link to a test case showing the issue, I'll be able to debug it and say what is going wrong.

    Allan

  • tanishqbiswastanishqbiswas Posts: 4Questions: 1Answers: 0
    edited February 22

    https://www.bosch-home.com/de/produkte/produktvergleich?products=HNG6764S6,HNG6764B6,HSG636XS6,HMG776NB1,CSG656RB7

    to get console error message, scroll down to get a undefined ixed header error and click on right button beside product to get a undefined column error

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Thanks for the link!

    I think the issue stems from a warning given further up in the console:

    Uncaught (in promise) Warning: FixedHeader requires DataTables 2 or newer

    That is resulting in this.elm.dataTable being undefined and this an error when scrolling.

    You are using DataTables 1.10.21, but have loaded FixedHeader 4.0.0 which requires DataTables 2.

    Are you using npm and a package bundler? What are the dependencies shown in your package.json for the datatables.net* packages?

    Allan

  • tanishqbiswastanishqbiswas Posts: 4Questions: 1Answers: 0
    dependencies": {
        "datatables.net-fixedcolumns": "3.3.3",
        "datatables.net": "1.10.21",
        "datatables.net-fixedcolumns-dt": "^3.3.1",
        "datatables.net-dt": "^1.10.21",
        "datatables.net-fixedheader-dt": "^3.1.7",
    
    "datatables": [
                "./bower_components/datatables.net/js/jquery.dataTables.min.js",
                "./bower_components/datatables.net-fixedcolumns/js/dataTables.fixedColumns.min.js",
                "./bower_components/datatables.net-fixedheader/js/dataTables.fixedHeader.min.js"
            ]
    

    we are using it in bower v1.8.14

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
        "datatables.net-fixedcolumns": "^4.3.1",
        "datatables.net": "1.10.21",
        "datatables.net-fixedcolumns-dt": "^4.3.1",
        "datatables.net-dt": "^1.10.21",
        "datatables.net-fixedheader-dt": "^3.4.1",
    

    please? Some of the old packages had dependency versions that were too broad, and thus were bringing in newer, incompatible versions.

    Thanks,
    Allan

  • tanishqbiswastanishqbiswas Posts: 4Questions: 1Answers: 0

    Previously, everything was functioning well with the same version for an extended period. Have there been any recent changes?

    Thanks

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Yes, DataTables 2 is now available. It might be something related to that, but without a test case or a way to reproduce the error you are seeing it is impossible to say for sure. Please provide a test git repo or a StackBltiz showing the error so I can offer some help to resolve the problem, beyond what I have already suggested.

    Allan

Sign In or Register to comment.