Skip to content

Error occurs when refreshing page if hasBoundCheck = true. #19

@zturchan

Description

@zturchan

This can be reproed on the current version of the demo page.
I'm using Chrome 114 on Windows 10 Home.

If you go to the demo page, resize a column, and refresh the page you get a JS error that results in the grid failing to complete it's load.
image

jquery.dataTables.colResize.js:478 Uncaught TypeError: Cannot read properties of null (reading 'addClass')
    at ColResize._fnShowMaxBoundReached (jquery.dataTables.colResize.js:478:39)
    at ColResize._fnBoundCheck (jquery.dataTables.colResize.js:457:22)
    at ColResize._fnApplyWidth (jquery.dataTables.colResize.js:337:61)
    at jquery.dataTables.colResize.js:164:22
    at Array.forEach (<anonymous>)
    at ColResize.fnRestoreState (jquery.dataTables.colResize.js:151:18)
    at ColResize._fnConstruct (jquery.dataTables.colResize.js:302:22)
    at new ColResize (jquery.dataTables.colResize.js:103:18)
    at HTMLDocument.<anonymous> (jquery.dataTables.colResize.js:613:17)
    at HTMLDocument.dispatch (jquery-2.2.4.min.js:3:7537)

If you reload the page, the error persists until you clear the local storage.
Here's the generated contents of my local storage for referece.

image

The issue appears to have something to do with calculating/inferring the max widths of an element.

I downloaded the repo and was able to reproduce the issue locally as well. However, if I change index.html so that the hasBoundCheck option is false instead of true, the issue goes away.

I think for my purposes I don't need the hasBoundCheck functionality, but if this could be fixed that would be awesome. Let me know if there's any other information you need.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions