With certain settings, the buttons disappear when resized on my custom responsive layout

With certain settings, the buttons disappear when resized on my custom responsive layout

hm123hm123 Posts: 84Questions: 27Answers: 1

Link to test case: https://live.datatables.net/waxitoca/1/edit

Error messages shown:
dataTables.js:1185
Uncaught
TypeError: Cannot read properties of undefined (reading 'length')
at _pluck (dataTables.js:1185:18)
at HTMLTableElement.<anonymous> (dataTables.js:12750:27)
at HTMLTableElement.dispatch (jquery-3.7.1.min.js:2:40035)
at v.handle (jquery-3.7.1.min.js:2:38006)
at Object.trigger (jquery-3.7.1.min.js:2:70124)
at ce.fn.init.triggerHandler (jquery-3.7.1.min.js:2:70811)
at _fnCallbackFire (dataTables.js:6491:50)
at _Api.<anonymous> (dataTables.js:8741:7)
at _Api.iterator (dataTables.js:6920:17)
at _Api.<anonymous> (dataTables.js:8739:10)
_pluck @ dataTables.js:1185
(anonymous) @ dataTables.js:12750
dispatch @ jquery-3.7.1.min.js:2
v.handle @ jquery-3.7.1.min.js:2
trigger @ jquery-3.7.1.min.js:2
triggerHandler @ jquery-3.7.1.min.js:2
_fnCallbackFire @ dataTables.js:6491
(anonymous) @ dataTables.js:8741
iterator @ dataTables.js:6920
(anonymous) @ dataTables.js:8739
iterator @ dataTables.js:6890
(anonymous) @ dataTables.js:8725
(anonymous) @ dataTables.js:7010
(anonymous) @ dataTables.js:9693
iterator @ dataTables.js:6890
(anonymous) @ dataTables.js:9672
(anonymous) @ dataTables.js:7010
handleResize @ test.html:177
later @ test.html:164
setTimeout
executedFunction @ test.html:167

Description of problem:
I've made this datatable responsive with debounce, and the layout changes depending on the screen size.
My issue is, all the buttons disappear on certain settings after a resize.

Currently, when the datatables is initialized on either desktop or mobile screen size, the buttons display correctly at first.
But when I resize from either to the other size, the buttons disappear. And I get the error message shown above.

Furthermore, I notice when I remove:
visible: false

from:
columns: [
{ title: "Name", visible: false }, ]

this issue doesn't occur.

Also if I remove:
ordering: false,

the issue doesnt also doesn't occur, even if I still have the "visible: false" from before.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,441Questions: 1Answers: 10,465 Site admin

    I don't have an immediate answer I'm afraid. I'll need to spend a bit more time than the 5 minutes that I've just poked around with this on it. I'll try to do that in the next few days.

    Allan

  • allanallan Posts: 63,441Questions: 1Answers: 10,465 Site admin
    Answer ✓

    Hi,

    Fixed with this commit. I'll release 2.1.5 with this fix next week.

    Regards,
    Allan

Sign In or Register to comment.