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
|
// Render a StockItem instance within a table
|
||||||
export function StockColumn(props: StockColumnProps): TableColumn {
|
export function StockColumn(props: StockColumnProps): TableColumn {
|
||||||
return {
|
return {
|
||||||
accessor: props.accessor ?? 'stock_item',
|
|
||||||
title: t`Stock Item`,
|
title: t`Stock Item`,
|
||||||
...props,
|
...props,
|
||||||
|
ordering: props.ordering || 'stock',
|
||||||
|
accessor: props.accessor || 'stock',
|
||||||
render: (record: any) => {
|
render: (record: any) => {
|
||||||
const stock_item =
|
const stock_item =
|
||||||
resolveItem(record, props.accessor ?? 'stock_item_detail') ?? {};
|
resolveItem(record, props.accessor ?? 'stock_item_detail') ?? {};
|
||||||
|
|||||||
@@ -486,6 +486,10 @@ export function InvenTreeTable<T extends Record<string, any>>({
|
|||||||
tableState.setPage(1);
|
tableState.setPage(1);
|
||||||
setSortStatus(status);
|
setSortStatus(status);
|
||||||
|
|
||||||
|
if (!status.columnAccessor) {
|
||||||
|
console.error('Invalid column accessor provided for table sorting');
|
||||||
|
}
|
||||||
|
|
||||||
setTableSorting(cacheKey)(status);
|
setTableSorting(cacheKey)(status);
|
||||||
},
|
},
|
||||||
[cacheKey]
|
[cacheKey]
|
||||||
|
|||||||
Reference in New Issue
Block a user