mirror of
https://github.com/inventree/InvenTree.git
synced 2025-10-14 21:22:20 +00:00
Fix rendering for custom status values (#10492)
- Improve field lookup priority
This commit is contained in:
@@ -194,7 +194,10 @@ export function TableStatusRenderer(
|
||||
accessor?: string
|
||||
): ((record: any) => any) | undefined {
|
||||
return (record: any) => {
|
||||
const status = resolveItem(record, accessor ?? 'status');
|
||||
const status =
|
||||
resolveItem(record, accessor ?? 'status') ??
|
||||
resolveItem(record, 'status_custom_key') ??
|
||||
resolveItem(record, 'status');
|
||||
|
||||
return (
|
||||
status && (
|
||||
|
@@ -368,14 +368,14 @@ export type StatusColumnProps = TableColumnProps & {
|
||||
};
|
||||
|
||||
export function StatusColumn(props: StatusColumnProps): TableColumn {
|
||||
const accessor: string = props.accessor ?? 'status';
|
||||
const accessor: string = props.accessor ?? 'status_custom_key';
|
||||
|
||||
return {
|
||||
accessor: 'status',
|
||||
sortable: true,
|
||||
switchable: true,
|
||||
minWidth: '50px',
|
||||
render: TableStatusRenderer(props.model, accessor ?? 'status_custom_key'),
|
||||
render: TableStatusRenderer(props.model, accessor),
|
||||
...props
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user