скролл с виртуализацией fix
This commit is contained in:
parent
0686b3ae8a
commit
57eba099c1
@ -141,10 +141,22 @@ const RealtimeTable = ({ formType, formId, sheetName, direction }) => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
columnVirtualizerOptions: ({ table }) => ({
|
columnVirtualizerOptions: ({ table }) => ({
|
||||||
overscan: 5,
|
overscan: 1,
|
||||||
measureElement: (el) => {
|
measureElement: (el) => {
|
||||||
|
if (!el) return 150;
|
||||||
const index = Number(el?.getAttribute?.('data-index'));
|
const index = Number(el?.getAttribute?.('data-index'));
|
||||||
return table.getVisibleLeafColumns()[index]?.getSize() ?? 0;
|
// const index = indx < 4 ? indx : indx;
|
||||||
|
// const index = indx;
|
||||||
|
const isPinned = Boolean(el?.getAttribute?.('data-pinned'));
|
||||||
|
if (isPinned) {
|
||||||
|
const colId = table.getState().columnPinning.left[index];
|
||||||
|
const column = table.getColumn(colId);
|
||||||
|
return column.columnDef.size;
|
||||||
|
|
||||||
|
}
|
||||||
|
const allCols = [...table.getLeftVisibleLeafColumns(), ...table.getCenterVisibleLeafColumns()]
|
||||||
|
return allCols[index]?.getSize() ?? 150;
|
||||||
|
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
enableRowSelection: true,
|
enableRowSelection: true,
|
||||||
@ -243,11 +255,11 @@ const RealtimeTable = ({ formType, formId, sheetName, direction }) => {
|
|||||||
if (columnPinning && Object.keys(columnPinning).length > 0) {
|
if (columnPinning && Object.keys(columnPinning).length > 0) {
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
setColumnPinning(prev => ({ ...prev }));
|
setColumnPinning(prev => ({ ...prev }));
|
||||||
}, 10);
|
}, 100);
|
||||||
|
|
||||||
return () => clearTimeout(timer);
|
return () => clearTimeout(timer);
|
||||||
}
|
}
|
||||||
}, [table]);
|
}, []);
|
||||||
|
|
||||||
const handleAddRow = useCallback(() => {
|
const handleAddRow = useCallback(() => {
|
||||||
const allRows = table.getRowModel().rows;
|
const allRows = table.getRowModel().rows;
|
||||||
|
|||||||
4015
web/src/components/RealtimeTable/constants/FORM_1/AHR.js
Normal file
4015
web/src/components/RealtimeTable/constants/FORM_1/AHR.js
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user