2
0
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:
Oliver
2026-02-19 17:18:53 +11:00
committed by GitHub
parent a4a399022f
commit 3dbe168939
2 changed files with 6 additions and 1 deletions

View File

@@ -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') ?? {};

View File

@@ -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]