Skip to content

Adding natural sorting as a sorting strategy - #1424

Open
ClosedEyesSeeing wants to merge 1 commit into
tabalinas:masterfrom
ClosedEyesSeeing:master
Open

Adding natural sorting as a sorting strategy#1424
ClosedEyesSeeing wants to merge 1 commit into
tabalinas:masterfrom
ClosedEyesSeeing:master

Conversation

@ClosedEyesSeeing

Copy link
Copy Markdown

Using the 'numeric' and 'sensitivity' options in localCompare to provide a Natural Sort strategy.

This will keep the original intended sorting in place but provide an alternative for those that wish to use natural sorting for alphanumeric characters.

Example:

Normal string sort

  1. Item 1
  2. Item 10
  3. Item 2

Natural sort:

  1. Item 1
  2. Item 2
  3. Item 10

Usage is the same as any other sort strategy in jsGrid:

{ fields: [ ... { name: "Name", sorter: "stringNaturalSort" }, ... ] }

Using the 'numeric' and 'sensitivity' options in localCompare to provide a Natural Sort strategy.
rok9ru added a commit to rok9ru/jsxgrid that referenced this pull request Aug 28, 2026
Opt-in strategy using localeCompare's numeric collation (so 'item2' sorts
before 'item10'); default 'string' strategy is untouched.

Cherry-picked from upstream PR tabalinas#1424.
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.

1 participant