Skip to content

feat(sort): sort on a value returned by the column - #239

Merged
sokumon merged 1 commit into
masterfrom
feat/column-sort-value
Sep 18, 2026
Merged

sokumon merged 1 commit into
masterfrom
feat/column-sort-value

Conversation

@mihir-kandoi

Copy link
Copy Markdown
Contributor

Sorting compares cell.content, so a column that renders something other than its stored value sorts by the value the user cannot see. In Frappe this shows up on Link columns that display a document's title field: the cell reads Acme Corp but sorts under CUST-0099.

compareValue already solves this for filtering. sortValue is the same idea for sorting: a column with a sortValue(cell) function sorts on what that returns, and columns without one are unchanged.

{
    name: "Customer",
    sortValue: cell => cell.title || cell.content,
}

Sorting compares `cell.content`, so a column that renders something other than
its stored value sorts by the value the user cannot see. `compareValue` already
solves this for filtering; `sortValue` is the same idea for sorting.

A column with a `sortValue(cell)` function sorts on what that returns. Columns
without one are unchanged.
@mihir-kandoi

Copy link
Copy Markdown
Contributor Author

@sokumon 🙏

@sokumon

sokumon commented Sep 18, 2026

Copy link
Copy Markdown
Member

Hey sorry for the delay reviewing it now

@sokumon
sokumon merged commit fe26a68 into master Sep 18, 2026
1 check passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.21.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

bvisible added a commit to bvisible/datatable that referenced this pull request Sep 29, 2026
Brings in upstream's fixes since our last merge:
- the body cells follow a column while it is being resized (frappe#240);
- the sticky columns' offsets are recomputed after a column resize (frappe#241);
- a column can be sorted on a value it returns (frappe#239);
- the tree keeps its expanded rows when a column is frozen (frappe#238);
- the toast and the column menu sit above the sticky columns (frappe#237, frappe#236).

One conflict, src/style.css: the column menu's z-index. Ours (100) is kept,
marked //// Neoffice: upstream's 10 clears the sticky columns but not the
layers our desk puts over a list. dist/ rebuilt (rollup), as frappe consumes
the built files of this fork.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants