DataTables / Responsive

Responsive extension for DataTables, providing support for complex tables on all device screen sizes
Other
149 stars 88 forks source link

Upgrade 3.0.2 to 3.0.3 creates TypeError #131

Open uhafner opened 2 months ago

uhafner commented 2 months ago

I packaged DataTables with the responsive module as a Jenkins DataTables Plugin so that Jenkins plugins can use DataTables in their views. The plugin deploys the following artifacts as a Jenkins plugin:

 "dependencies": {
    "datatables.net": "2.1.6",
    "datatables.net-bs5": "2.1.6",
    "datatables.net-buttons": "3.1.2",
    "datatables.net-buttons-bs5": "3.1.2",
    "datatables.net-colreorder": "2.0.4",
    "datatables.net-colreorder-bs5": "2.0.4",
    "datatables.net-responsive": "3.0.3",
    "datatables.net-responsive-bs5": "3.0.3",
    "datatables.net-select": "2.0.5",
    "datatables.net-select-bs5": "2.0.5",
    "datatables.mark.js": "2.1.0",
    "mark.js": "8.11.1",
    "luxon": "3.5.0"
  }

When I upgrade the dependency to datatables.net-responsive from 3.0.2 to 3.0.3 I get the following error:

jquery.min.js:2 jQuery.Deferred exception: Cannot read properties of undefined (reading '_responsiveMovesNodes') TypeError: Cannot read properties of undefined (reading '_responsiveMovesNodes')
    at a._resizeAuto (http://localhost:8080/static/4ac28f67/plugin/data-tables-api/js/dataTables.responsive.min.js:4:9609)
    at HTMLTableElement.<anonymous> (http://localhost:8080/static/4ac28f67/plugin/data-tables-api/js/dataTables.responsive.min.js:4:2584)
    at HTMLTableElement.<anonymous> (http://localhost:8080/static/4ac28f67/plugin/data-tables-api/js/dataTables.min.js:4:72080)
    at HTMLTableElement.dispatch (http://localhost:8080/static/4ac28f67/plugin/jquery3-api/js/jquery.min.js:2:40035)
    at v.handle (http://localhost:8080/static/4ac28f67/plugin/jquery3-api/js/jquery.min.js:2:38006)
    at Object.trigger (http://localhost:8080/static/4ac28f67/plugin/jquery3-api/js/jquery.min.js:2:70124)
    at HTMLTableElement.<anonymous> (http://localhost:8080/static/4ac28f67/plugin/jquery3-api/js/jquery.min.js:2:70726)
    at Function.each (http://localhost:8080/static/4ac28f67/plugin/jquery3-api/js/jquery.min.js:2:3129)
    at ce.fn.init.each (http://localhost:8080/static/4ac28f67/plugin/jquery3-api/js/jquery.min.js:2:1594)
    at ce.fn.init.trigger (http://localhost:8080/static/4ac28f67/plugin/jquery3-api/js/jquery.min.js:2:70701) undefined

An example of a Jenkins view with DataTables (with datatables.net-responsive 3.0.2) is visible in https://ci.jenkins.io/job/Plugins/job/coverage-model/job/main/lastSuccessfulBuild/coverage/

When I downgrade to 3.0.2 then everything works again, so there seems to be an incompatible change in 3.0.3.

Please let me know when you need more details.

AllanJard commented 2 months ago

Can you create a simple test case showing the issue please so I can debug and resolve it please? I don't immediately see that error in the examples here, so there must be some configuration or setup that I'm missing.

uhafner commented 2 months ago

Do you mean a standalone test case? Or something with the whole Jenkins setup that shows the problem in a running Jenkins instance?

AllanJard commented 2 months ago

A standalone test case that I can debug please. At the moment I'm not sure how I can see the issue.

uhafner commented 2 months ago

Ok, I will give my best to create a standalone example.

One additional note, maybe this is relevant: the table is filled by an Ajax call. So the error occurs when the tables still is empty.

uhafner commented 2 months ago

And an unrelated note on the example you linked above: there are two includes:

Is this correct?

AllanJard commented 2 months ago

Yes. The dataTables.responsive.js one is the main file. The responsive.dataTables.js one is more or less redundant for DataTables default styling, but if you switch to Bootstrap you would see it would change to responsive.bootstrap5.js.

The "rules" for file names are codified here.

The download builder is the best way to make sure you get the code you need.