Skip to content

fix: render enum column cell labels from options prop#24

Merged
vparys merged 1 commit intomainfrom
fix/datagrid-enum-column-cell-labels
Apr 21, 2026
Merged

fix: render enum column cell labels from options prop#24
vparys merged 1 commit intomainfrom
fix/datagrid-enum-column-cell-labels

Conversation

@vparys
Copy link
Copy Markdown
Member

@vparys vparys commented Apr 21, 2026

Summary

  • DataGridEnumColumn / DataGridEnumListColumn ignored the options prop when rendering cells — only the filter UI consumed it, so cells showed raw enum values. Cell renderers now receive enumOptions and enumName through ColumnRenderProps and resolve labels from the options record (falling back to the raw value).
  • The bindx-ui variant additionally falls back to the EnumOptionsFormatter context when options is absent but the field carries an enumName (now exported via enumScalar).
  • Extracted createColumnStaticRender from createColumn so enum columns — which need a narrower generic signature than ColumnComponent can express — can attach the static render via Object.assign.

Test plan

  • tests/react/dataview/dataGridEnumColumnOptions.test.tsx — headless dataview: options record labels, array fallback, enum list labels
  • tests/react/dataview/dataGridEnumColumnUi.test.tsx — bindx-ui: options record, children override, EnumOptionsFormatter context fallback, options > context priority, enum list labels
  • tests/react/dataview/dataGridFiltering.test.tsx updated to assert against labels (Published/Draft) instead of raw values

DataGridEnumColumn and DataGridEnumListColumn previously ignored the
`options` prop when rendering cells — only the filter UI used it, so
cells showed raw enum values. Cell renderers now receive `enumOptions`
and `enumName` via ColumnRenderProps and resolve labels from the
options record, falling back to the raw value.

The bindx-ui variant additionally falls back to EnumOptionsFormatter
context when `options` is absent but the field carries an `enumName`
(exported via `enumScalar`).

Extract `createColumnStaticRender` from `createColumn` so enum columns —
which need a narrower generic signature than `ColumnComponent` can
express — can attach the static render via `Object.assign`.
@vparys vparys merged commit e8ed9b1 into main Apr 21, 2026
3 checks passed
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