mirror of
https://github.com/inventree/InvenTree.git
synced 2026-02-25 16:17:58 +00:00
[UI] Bug fix for stock column ordering (#11376)
- Cannot have a blank accessor
This commit is contained in:
@@ -114,9 +114,10 @@ export type StockColumnProps = TableColumnProps & {
|
||||
// Render a StockItem instance within a table
|
||||
export function StockColumn(props: StockColumnProps): TableColumn {
|
||||
return {
|
||||
accessor: props.accessor ?? 'stock_item',
|
||||
title: t`Stock Item`,
|
||||
...props,
|
||||
ordering: props.ordering || 'stock',
|
||||
accessor: props.accessor || 'stock',
|
||||
render: (record: any) => {
|
||||
const stock_item =
|
||||
resolveItem(record, props.accessor ?? 'stock_item_detail') ?? {};
|
||||
|
||||
@@ -486,6 +486,10 @@ export function InvenTreeTable<T extends Record<string, any>>({
|
||||
tableState.setPage(1);
|
||||
setSortStatus(status);
|
||||
|
||||
if (!status.columnAccessor) {
|
||||
console.error('Invalid column accessor provided for table sorting');
|
||||
}
|
||||
|
||||
setTableSorting(cacheKey)(status);
|
||||
},
|
||||
[cacheKey]
|
||||
|
||||
Reference in New Issue
Block a user