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

White screen error when sorting by column with undefined data in any rows #873

Closed
clintdoriot opened this issue Aug 27, 2019 · 2 comments
Closed
Labels

Comments

@clintdoriot
Copy link

Sorting a column with undefined data for some rows causes white screen.
Console error: Uncaught TypeError: Cannot read property 'localeCompare' of undefined

This occurs when some of the rows do not have the datafield defined. For example:

data = [
  {
    "foo":1,
    "bar":2
  }, 
  {
    "foo":3
  }
]

The error occurs when attempting to sort on the "bar" column.

Expected Behavior

The table should still sort on that column, grouping columns with undefined data, and not cause the page to render a white screen.

Current Behavior

The entire page renders as a white screen, and the console displays the following error:
Uncaught TypeError: Cannot read property 'localeCompare' of undefined

Steps to Reproduce (for bugs)

https://codesandbox.io/embed/gracious-microservice-wdwp6

Your Environment

Tech Version
Material-UI 4.3
MUI-datatables 2.9.0 (I'm using 2.6.4, but the error is still present using 2.9.0 in the code sandbox
React 16.8.6
browser Chrome
etc
@gabrielliwerant
Copy link
Collaborator

Looks like a legit bug, thanks for reporting this!

@gabrielliwerant
Copy link
Collaborator

Should be fixed as of 2.11.0.

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

No branches or pull requests

2 participants