Skip to content

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

Open
mihir-kandoi wants to merge 1 commit into
masterfrom
feat/column-sort-value
Open

mihir-kandoi wants to merge 1 commit into
masterfrom
feat/column-sort-value

Conversation

@mihir-kandoi

Copy link
Copy Markdown

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.
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