mirror of
https://github.com/inventree/InvenTree.git
synced 2026-05-28 11:59:23 +00:00
[UI] Adjust table auto height (#12016)
* [UI] Adjust table auto height - Better height selection - Tested against more edge cases * Fix comment
This commit is contained in:
@@ -814,9 +814,9 @@ export function InvenTreeTableInternal<T extends Record<string, any>>({
|
|||||||
}, [tableProps.onCellClick, tableProps.onRowClick, tableProps.modelType]);
|
}, [tableProps.onCellClick, tableProps.onRowClick, tableProps.modelType]);
|
||||||
|
|
||||||
// When sticky headers are enabled, we adjust the maximum viewport height,
|
// When sticky headers are enabled, we adjust the maximum viewport height,
|
||||||
// based on the number of records being displayed (up to a maximum of 60vh)
|
// based on the number of records being displayed (up to a maximum of 80vh)
|
||||||
const autoHeight = useMemo(() => {
|
const autoHeight = useMemo(() => {
|
||||||
const rows = Math.max(10, Math.min(tableState.records.length, 60));
|
const rows = Math.min(80, 6 * Math.max(tableState.records.length, 3));
|
||||||
|
|
||||||
return `${rows}vh`;
|
return `${rows}vh`;
|
||||||
}, [tableState.records]);
|
}, [tableState.records]);
|
||||||
|
|||||||
Reference in New Issue
Block a user