Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error with JQuery DataTables and ColVis plugin "Cannot read property 'sWidth' of undefined"

Using the jquery.datatables plugin with the ColVis addon, I recieve this error when I remove a column:

"Cannot read property 'sWidth' of undefined". I haven't been able to find a solution to this error online.

I'm not sure what's causing the error, although I do have a fix that I would like to post for the benefit of other's who run into this issue.

I'm using jquery.datatables 1.9.4 from http://datatables.net/.

like image 513
Scott Terry Avatar asked Dec 19 '13 05:12

Scott Terry


1 Answers

I had this error when the number of columns in

<thead></thead>

was different from the number of columns in

$('#ls-table').DataTable($.extend({}, window.coonDataTableOptions, {
    columns: [
         <here>
    ]
 }));
like image 116
user1398619 Avatar answered Sep 22 '22 00:09

user1398619