This commit is contained in:
Jan Prochazka 2021-01-14 09:31:54 +01:00
parent 99746f48df
commit 35398dd401
2 changed files with 5 additions and 1 deletions

View File

@ -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}

View File

@ -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}