dtApi.columns([1,2,3,4]).visible(true);
dtApi.columns([1,2,3,4]).visible(true);
This isn't working after migration to version 2.1.3
Link to test case:
Debugger code (debug.datatables.net):
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.4.1.min.js:2:42571)
at v.handle (jquery-3.4.1.min.js:2:40572)
at Object.trigger (jquery-3.4.1.min.js:2:70627)
at k.fn.init.triggerHandler (jquery-3.4.1.min.js:2:71306)
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)
Description of problem:
Answers
Your code snippet works in this test case with 2.1.3:
https://live.datatables.net/ziwoweki/1/edit
The only thing I can think of is the table doesn't have 5 columns so the column indexes,
[1,2,3,4]
, refer to non-existent columns. If you still need help please provide a link to a test case replicating the issue so we can help debug.https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin