DataTablesSrc
DataTablesSrc copied to clipboard
Bugfix: Avoid "Uncaught TypeError: Cannot read property 'sWidth' of undefined"
while using column hider function (for example datatables.net-buttons/colVis).
Normally this issue is caused by defining more column than is in the HTML. Can you give me a link to an example showing the issue?
I created 2 small examples for this: https://github.com/takieszti91/ErrorExampleForDataTables This error occurs when I use lightColumnFilter, scrollX and colvis at the same time.
You have to hide column(s) with the button.
Thank you for the example. I believe it is caused by:
for (var i = 0; i < 6; i++) {
$scope.columnfilter_object[String(i)] = {html: 'input', type: 'text'};
}
It is always producing a 6 table column, but Angular is changing the DOM to only have 5 (or less) columns based on the click of the column selector. I believe the correct fix is actually to change that 6
to be dynamic based on the number of columns.
I tried to change my code, but unfortunately I cannot change the original column filter. I can only add a new one. The error is still there. Can I change somehow the original column filter?
I'm afraid you'd need to ask the author of the column filter plug-in about that. That is not software that was developed by ourselves.