fixed performance bug in grid

This commit is contained in:
Jan Prochazka 2021-01-14 10:18:40 +01:00
parent 9fe0c2ac86
commit 2cd2546f3f

View File

@ -300,6 +300,16 @@ export default function DataGridCore(props) {
return `Rows: ${allRowCount.toLocaleString()}`;
}, [selectedCells, allRowCount, grider, visibleRealColumns]);
const handleSetFormView = React.useMemo(
() =>
formViewAvailable && display.baseTable && display.baseTable.primaryKey
? (rowData) => {
display.switchToFormView(rowData);
}
: null,
[formViewAvailable, display]
);
if (!columns || columns.length == 0) return <LoadingInfo wrapper message="Waiting for structure" />;
if (errorMessage) {
@ -949,13 +959,6 @@ export default function DataGridCore(props) {
display.clearFilters();
};
const handleSetFormView =
formViewAvailable && display.baseTable && display.baseTable.primaryKey
? (rowData) => {
display.switchToFormView(rowData);
}
: null;
const handleSwitchToFormView =
formViewAvailable && display.baseTable && display.baseTable.primaryKey
? () => {