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

Cannot read property 'toLowerCase' of null when sorting. #241

Open
FraserChapman opened this issue Apr 11, 2016 · 2 comments
Open

Cannot read property 'toLowerCase' of null when sorting. #241

FraserChapman opened this issue Apr 11, 2016 · 2 comments

Comments

@FraserChapman
Copy link

When a column contains a null value the error is thrown when that column is sorted.

// Built-in sort functions
// (the most common use-cases I could think of)

aAttr = aAttr.toLowerCase();

jquery.dynatable.js:923 Uncaught TypeError: Cannot read property 'toLowerCase' of null

@lisrec
Copy link

lisrec commented Jun 24, 2016

Hi, I had similarly problem.
I had in column strings, and next after added number i got error "bAttr.toLowerCase(); is not a function".

I made little change in code (line 912 and 913):

aAttr = aAttr.toLowerCase(); bAttr = bAttr.toLowerCase();

change to this:

aAttr = aAttr.toString().toLowerCase(); bAttr = bAttr.toString().toLowerCase();

@lisrec
Copy link

lisrec commented Jun 24, 2016

About your problem, add before 912 line:
if(typeof aAttr == 'undefined') aAttr = "";
else if(aAttr == null) aAttr = "";

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

No branches or pull requests

2 participants