mirror of
https://github.com/inventree/InvenTree.git
synced 2025-07-02 03:30:54 +00:00
Data table tweaks (#9886)
- Remove skeleton which hid table - Updated hooks
This commit is contained in:
@ -1,5 +1,10 @@
|
|||||||
import { t } from '@lingui/core/macro';
|
import { t } from '@lingui/core/macro';
|
||||||
import { Box, type MantineStyleProp, Skeleton, Stack } from '@mantine/core';
|
import {
|
||||||
|
Box,
|
||||||
|
LoadingOverlay,
|
||||||
|
type MantineStyleProp,
|
||||||
|
Stack
|
||||||
|
} from '@mantine/core';
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import {
|
import {
|
||||||
type ContextMenuItemOptions,
|
type ContextMenuItemOptions,
|
||||||
@ -412,7 +417,7 @@ export function InvenTreeTable<T extends Record<string, any>>({
|
|||||||
newOrder.push(ACTIONS_COLUMN_ACCESSOR);
|
newOrder.push(ACTIONS_COLUMN_ACCESSOR);
|
||||||
tableColumns.setColumnsOrder(newOrder);
|
tableColumns.setColumnsOrder(newOrder);
|
||||||
}
|
}
|
||||||
}, [tableColumns.columnsOrder]);
|
}, [tableColumns.columnsOrder, tableColumns.setColumnsOrder]);
|
||||||
|
|
||||||
// Reset the pagination state when the search term changes
|
// Reset the pagination state when the search term changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -670,7 +675,7 @@ export function InvenTreeTable<T extends Record<string, any>>({
|
|||||||
columnIndex: number;
|
columnIndex: number;
|
||||||
}) => {
|
}) => {
|
||||||
// Ignore any click on the 'actions' column
|
// Ignore any click on the 'actions' column
|
||||||
if (column.accessor == '--actions--') {
|
if (column.accessor == ACTIONS_COLUMN_ACCESSOR) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -815,10 +820,6 @@ export function InvenTreeTable<T extends Record<string, any>>({
|
|||||||
);
|
);
|
||||||
}, [tableProps.onCellClick, tableProps.onRowClick, tableProps.modelType]);
|
}, [tableProps.onCellClick, tableProps.onRowClick, tableProps.modelType]);
|
||||||
|
|
||||||
if (!tableState.storedDataLoaded) {
|
|
||||||
return <Skeleton w='100%' h='100%' animate />;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Stack gap='xs'>
|
<Stack gap='xs'>
|
||||||
@ -837,6 +838,7 @@ export function InvenTreeTable<T extends Record<string, any>>({
|
|||||||
)}
|
)}
|
||||||
<Boundary label={`InvenTreeTable-${tableState.tableKey}`}>
|
<Boundary label={`InvenTreeTable-${tableState.tableKey}`}>
|
||||||
<Box pos='relative'>
|
<Box pos='relative'>
|
||||||
|
<LoadingOverlay visible={!tableState.storedDataLoaded} />
|
||||||
<DataTable
|
<DataTable
|
||||||
withTableBorder={!tableProps.noHeader}
|
withTableBorder={!tableProps.noHeader}
|
||||||
withColumnBorders
|
withColumnBorders
|
||||||
|
Reference in New Issue
Block a user