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

Fix #4555 - DataTable: Add nullSortOrder prop #4570

Merged
merged 4 commits into from
Oct 10, 2023

Conversation

FlipWarthog
Copy link
Contributor

Fix #4555 - DataTable: Add nullSortOrder prop and better null/undefined handling in component sort functions.

@vercel
Copy link

vercel bot commented Oct 6, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
primevue ⬜️ Ignored (Inspect) Visit Preview Oct 6, 2023 11:15pm

@tugcekucukoglu tugcekucukoglu merged commit cde6e2b into primefaces:master Oct 10, 2023
1 of 2 checks passed
@FlipWarthog FlipWarthog deleted the PV4555 branch October 10, 2023 23:35

localeComparator() {
//performance gain using Int.Collator. It is not recommended to use localeCompare against large arrays.
return new Intl.Collator(undefined, { numeric: true }).compare;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The collator only needs to be instantiated once, not once per function call to get the collator.

const localeComparator = new Intl.Collator(undefined, { numeric: true }).compare;
export default {
   ...
   ...
   localeComparator() {
      return localeComparator;
   }
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct in PrimeReact we only instantiate it once outside of the loop.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MoMack20 I have a new PR in to add a localeCode configuration for localization, so I think that might not entirely be true with this change (or I can revisit it in that PR): #4628

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.

Datatable: Sort mode multiple - undefined breaks order
4 participants