Skip to content

Conversation

MikeKingdom
Copy link
Collaborator

In a Datatable, If you have a sortable column and some of the rows have a string value but some have a null, undefined or no value for that property then the table doesn't sort by that column.

What does this PR do?

This fixes Datatable sorting so that when some rows have a null or undefined value for a property it treats that value as an empty string for sorting purposes.

Where should the reviewer start?

buildState.js

What testing has been done on this PR?

Manual testing via storybook as well as added jest test cases.

How should this be manually tested?

Do Jest tests follow these best practices?

  • screen is used for querying.
  • The correct query is used. (Refer to this list of queries)
  • userEvent is used in place of fireEvent.
  • asFragment() is used for snapshot testing.

Any background context you want to provide?

What are the relevant issues?

Closes #6281

Screenshots (if appropriate)

image

image

Do the grommet docs need to be updated?

No

Should this PR be mentioned in the release notes?

Yes

Is this change backwards compatible or is it a breaking change?

Backwards compatible

@ericsoderberghp ericsoderberghp merged commit 22aa3f4 into master Aug 18, 2022
@ericsoderberghp ericsoderberghp deleted the fix-datatable-null-sort branch August 18, 2022 05:32
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.

Data Table sort breaks if a property is null or undefined
2 participants