Skip to content

When Ref/RefList column shows a Choice column, render it as a choice#2277

Draft
dsagal wants to merge 1 commit into
mainfrom
ref-to-choice
Draft

When Ref/RefList column shows a Choice column, render it as a choice#2277
dsagal wants to merge 1 commit into
mainfrom
ref-to-choice

Conversation

@dsagal

@dsagal dsagal commented Apr 18, 2026

Copy link
Copy Markdown
Member

Context

A Reference or Reference List column may show a column from the referenced table of type Choice, but it's always rendered without color. It would be nicer to keep the styling in such cases.

Proposed solution

If the "Show Column" is of type Choice, use that Choice's styling for rendering a Reference or Reference List column.

Related issues

#1222

Has this been tested?

TBD: Tests to be created. Also, when entering a reference data, we could be showing colored choices, but the PR doesn't have this yet.

  • 👍 yes, I added tests to the test suite
  • 💭 no, because this PR is a draft and still needs work
  • 🙅 no, because this is not relevant here
  • 🙋 no, because I need help

Screenshots / Screencasts

Preview with an example here: https://grist-gristlabs-grist-core-ref-to-choice.fly.dev/sbufBSzwPXTz/Restaurant-Inventory/p/8

Screenshot showing what it looks like:

Screen Shot 2026-04-17 at 22 37 49

@dsagal dsagal added the preview Launch preview deployment of this PR label Apr 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Deployed commit 4a0d66d3ac8c11aeaaae7d3586e12518c9bcc7d0 as https://grist-gristlabs-grist-core-ref-to-choice.fly.dev (until 2026-05-18T02:11:17.389Z)

@dsagal dsagal removed the preview Launch preview deployment of this PR label May 29, 2026
@dsagal dsagal marked this pull request as draft June 19, 2026 05:41
@dsagal

dsagal commented Jun 19, 2026

Copy link
Copy Markdown
Member Author

If anyone is wondering about this diff, I'm holding off on it because I think it's a wrong approach.

It does allow references that are colored, but that's about it. The way to achieve it is very awkward. And once you think about the actual goal and mechanism, it seems just wrong: the goal is to associate a color with every row of a table. The way you'd have to do it in this approach is to turn an identifier column into a Choice column, and use the Choice configuration to associate a color with every value. That means manual sync of values in the column with the Choice's configuration.

A better mechanism would be if a color could be associated with a record, and then shown in the style of a reference value pill.

This may be bets done as part of another concept: a "record identity". Today there is just "Show column", and it's a setting on each reference, not on the referenced table. Instead, imagine that a table could say: this record is identified by this field and color. Every reference column would then show a colored pill. (You could further allow the record identity to include multiple fields, and an icon. This would make for more recognizable reference values.)

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