Files
wekan/docs/Features/Board-Header/Sort-Cards.md
T
Lauri Ojansivu 9e97f5119d Docs: Board header and board views: what each feature is, how to use it, how its numbers are calculated, how it works, and its commits.
Search now describes the two separate buttons (the shared headerSearchButton
template is gone), the sidebar toggle, stepping through results and what is
searched; Activity rendering names Admin Panel / Settings / Security, where
the security controls moved; Chat view lists only cards with a conversation
and the unread counts; Calendar gets its title and all its dates.

Thanks to xet7 !
2026-11-22 18:06:25 +02:00

6.3 KiB

Board header / Sort Cards

What it is

Sort Cards changes the order the cards are shown in inside each list: by due date, by title, by when they were created, by votes or by the board's label order. It only changes what you see. No card is moved, and turning sorting off puts the cards back in the order they were dragged into.

Read more

  • Sorting algorithm and stable sort on Wikipedia - how a list is put in order, and why cards with an equal rank keep their manual order here.
  • Collation on Wikipedia - the ordering of text, as in Title (Alphabetically).
  • Filter and Search - the other ways to narrow or find cards.

How to use it

The control after Watch in a board's header controls (fa-sort). Its label and tooltip are Sort Cards, or Sort is on while a sort is chosen; the button is then emphasised and an X beside it (Remove sort) turns sorting off. See the header for its place in the bar.

Sort the cards.

  1. Open a board.
  2. Click Sort Cards in the header bar. The popup opens.
  3. Click one of Due Date, Title (Alphabetically), Created At (Newest First), Created At (Oldest First), Sort by votes or Label order.
  4. The popup closes, the cards in each list are shown in that order, and the button says Sort is on.

Turn sorting off.

  1. Click the X (Remove sort) beside Sort is on.
  2. The cards return to their manual (dragged) order.

Any signed-in user can use it. It changes only how the cards are shown to you: it is stored in your browser (the sortBy Session value, saved to localStorage as wekan-cards-sortBy so it survives a reload), not on the board, and no card's position is changed.

Change the label order (for Label order): a board admin edits a label and uses Move up / Move down.

How the numbers are calculated

cardsSortPopup in client/components/boards/boardHeader.jade. Choosing an entry sorts the cards inside each list and closes the popup.

Entry Order
Due Date Earliest due date first (dueAt: 1).
Title (Alphabetically) Title A to Z (title: 1).
Created At (Newest First) Newest card first (createdAt: -1).
Created At (Oldest First) Oldest card first (createdAt: 1).
Sort by votes Highest vote score (positive minus negative) first.
Label order By the board's label order: a card goes where its first label in that order goes, cards without a label last.
  • Field sorts. The first four are passed to the card cursor as a sort, with the card _id as a tie-breaker (sortWithIdTiebreaker, #6511), so two cards with the same value always come in the same order. A card with no due date has no dueAt, which MongoDB orders before every date.
  • Vote score = number of positive votes minus number of negative votes (voteScore in models/lib/voteSortCards.js). Cards are sorted by that score, highest first.
  • Label rank = the smallest position, in the board's label list, of any of the card's labels; a card with none of the board's labels gets infinity and goes last (labelRank in models/lib/labelOrder.js).
  • Ties. In both display orders cards with an equal score or rank keep their manual order, because the cards are first read in their manual sort order and then sorted stably.
  • Which cards. The sort applies to the cards of a list that are loaded; on a board that loads cards lazily, that is the list's current window, which grows as you scroll (cardsWithLimit() in client/components/lists/listBody.js).

How it works in WeKan

Commits