dhobi/datatables.colResize

Got error if there are some invisible columns

cungobu opened this issue · 3 comments

I got an issue when some columns in my table are invisible which can be set by
columnDefs: [ { targets: [0, 1], visible: false }]
or
columns: [{ title: 'Customer Name', data: 'Name', visible: false }]

I'm using colResize with saveState = true. It's ok for the first time but since the next time I got the error like this
Uncaught TypeError: Cannot read properties of null (reading 'match')
from the line
column.sWidth.match(/(\d+)/i)
as sWidth was undefined which could be caused by calculating the width of an invisible DOM.

Actually, we can check null / undefined then skip & continue with visible columns because we do not need to resize invisible columns.

I saw this too. Just adding a screenshot of the bug in a production app:
screenshot-of-production-bug

dhobi commented

Merged and published. Please recheck with v1.7.1 and close the issue if resolved.

Looks like the PR #11 fixed the original error message! 🎉

But now I see another error message coming from within the _fnShowMaxBoundReached function. If you still have the console open and refresh the "AFTER" demo, there's now an Uncaught TypeError: Cannot read properties of null (reading 'addClass') ❌ 😢

image

image