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
|
accessor?: string
|
||||||
): ((record: any) => any) | undefined {
|
): ((record: any) => any) | undefined {
|
||||||
return (record: any) => {
|
return (record: any) => {
|
||||||
const status = resolveItem(record, accessor ?? 'status');
|
const status =
|
||||||
|
resolveItem(record, accessor ?? 'status') ??
|
||||||
|
resolveItem(record, 'status_custom_key') ??
|
||||||
|
resolveItem(record, 'status');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
status && (
|
status && (
|
||||||
|
@@ -368,14 +368,14 @@ export type StatusColumnProps = TableColumnProps & {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function StatusColumn(props: StatusColumnProps): TableColumn {
|
export function StatusColumn(props: StatusColumnProps): TableColumn {
|
||||||
const accessor: string = props.accessor ?? 'status';
|
const accessor: string = props.accessor ?? 'status_custom_key';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
accessor: 'status',
|
accessor: 'status',
|
||||||
sortable: true,
|
sortable: true,
|
||||||
switchable: true,
|
switchable: true,
|
||||||
minWidth: '50px',
|
minWidth: '50px',
|
||||||
render: TableStatusRenderer(props.model, accessor ?? 'status_custom_key'),
|
render: TableStatusRenderer(props.model, accessor),
|
||||||
...props
|
...props
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user