Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: Avoid "Uncaught TypeError: Cannot read property 'sWidth' of undefined" #152

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

takieszti91
Copy link

while using column hider function (for example datatables.net-buttons/colVis).

…ndefined" while using column hider function (for example datatables.net-buttons/colVis).
@DataTables
Copy link
Collaborator

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?

takieszti91 added a commit to takieszti91/ErrorExampleForDataTables that referenced this pull request Nov 19, 2019
@takieszti91
Copy link
Author

takieszti91 commented Nov 19, 2019

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.

@takieszti91
Copy link
Author

You have to hide column(s) with the button.

@DataTables
Copy link
Collaborator

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.

@takieszti91
Copy link
Author

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?

@DataTables
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants