From 35398dd40148d008bdf4f17ad50021d209a0059b Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Thu, 14 Jan 2021 09:31:54 +0100 Subject: [PATCH] fix #56 --- packages/web/src/datagrid/JslDataGridCore.js | 3 +++ packages/web/src/datagrid/LoadingDataGridCore.js | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/web/src/datagrid/JslDataGridCore.js b/packages/web/src/datagrid/JslDataGridCore.js index 4c09f3f8..04c469ab 100644 --- a/packages/web/src/datagrid/JslDataGridCore.js +++ b/packages/web/src/datagrid/JslDataGridCore.js @@ -40,6 +40,7 @@ async function loadRowCount(props) { export default function JslDataGridCore(props) { const { jslid } = props; const [changeIndex, setChangeIndex] = React.useState(0); + const [rowCountLoaded, setRowCountLoaded]= React.useState(null); const showModal = useShowModal(); @@ -65,6 +66,7 @@ export default function JslDataGridCore(props) { (stats) => { if (stats.changeIndex < changeIndex) return; setChangeIndex(stats.changeIndex); + setRowCountLoaded(stats.rowCount); }, [changeIndex] ); @@ -85,6 +87,7 @@ export default function JslDataGridCore(props) { loadDataPage={loadDataPage} dataPageAvailable={dataPageAvailable} loadRowCount={loadRowCount} + rowCountLoaded={rowCountLoaded} loadNextDataToken={changeIndex} onReload={() => setChangeIndex(0)} griderFactory={RowsArrayGrider.factory} diff --git a/packages/web/src/datagrid/LoadingDataGridCore.js b/packages/web/src/datagrid/LoadingDataGridCore.js index e54d6758..107ef0ca 100644 --- a/packages/web/src/datagrid/LoadingDataGridCore.js +++ b/packages/web/src/datagrid/LoadingDataGridCore.js @@ -14,6 +14,7 @@ export default function LoadingDataGridCore(props) { griderFactory, griderFactoryDeps, onChangeGrider, + rowCountLoaded, } = props; const [loadProps, setLoadProps] = React.useState({ @@ -131,7 +132,7 @@ export default function LoadingDataGridCore(props) { isLoadedAll={isLoadedAll} loadedTime={loadedTime} exportGrid={exportGrid} - allRowCount={allRowCount} + allRowCount={rowCountLoaded || allRowCount} openQuery={openQuery} isLoading={isLoading} grider={grider}