teable icon indicating copy to clipboard operation
teable copied to clipboard

Sort != Sort (Gallery & Grid Views)

Open ScriptJunky opened this issue 8 months ago • 3 comments

Describe the bug When sorting based on a Lookup field, the sorting is not correct.

To Reproduce

  1. Create a table
  2. create a second table
  3. Link the 2 tables
  4. Create a lookup column in table 2 that pulls values from table 1
  5. Create a gallery view
  6. Sort the view based on the lookup column

Expected behavior The values are sorted naturally

Screenshots Image

Image Image

** Client (please complete the following information):**

  • OS: EndeavourOS (Arch Linux)
  • Browser: Vivaldi 7.9.3970.45 (Official Build) (64-bit)
  • Version Teable App version: 0.5.0-alpha+1.10.0-build.1267

Platform (Please tell us which deployment version you are using) docker compose

Additional context N/A

ScriptJunky avatar Apr 01 '26 14:04 ScriptJunky

Can i work on this issue I think the issue comes from how lookup values are being handled during sorting. Right now it looks like we might be sorting on raw/internal values instead of what’s actually displayed.

A couple of things that could help fix this:

Resolve the lookup values before sorting so we’re comparing the actual displayed data, not IDs or references. Since lookup fields can return arrays, normalize them into something comparable — either take the first value or join them into a string. Use a proper comparator depending on the type

Ingole712521 avatar Apr 21 '26 08:04 Ingole712521

@Ingole712521 here's the community link where troubleshooting occurred and a workaround was put in place; https://community.teable.ai/t/sorting-of-lookup-field-values-does-not-seem-to-work/189/17

To summarize, sort follows the order of the list of single/multi select options, and not alphabetically.

ScriptJunky avatar Apr 21 '26 12:04 ScriptJunky

@ScriptJunky thank you for the report and for following up in the community thread.

As discussed here, sorting single-select and multi-select values follows the option order defined in the source field, not alphabetical order, and lookup fields inherit that order: https://community.teable.ai/t/sorting-of-lookup-field-values-does-not-seem-to-work/189/17

The workaround you shared, sorting by a formula/text field derived from the lookup value and hiding that helper field, is the right path for alphabetical sorting today. I am closing this issue because the reported behavior is the current sorting model, and we are not treating it as a bug fix. The feature suggestion for automatic select-option sorting has been noted from the community discussion.

HynLcc avatar Jul 06 '26 11:07 HynLcc