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) { export default function JslDataGridCore(props) {
const { jslid } = props; const { jslid } = props;
const [changeIndex, setChangeIndex] = React.useState(0); const [changeIndex, setChangeIndex] = React.useState(0);
const [rowCountLoaded, setRowCountLoaded]= React.useState(null);
const showModal = useShowModal(); const showModal = useShowModal();
@@ -65,6 +66,7 @@ export default function JslDataGridCore(props) {
(stats) => { (stats) => {
if (stats.changeIndex < changeIndex) return; if (stats.changeIndex < changeIndex) return;
setChangeIndex(stats.changeIndex); setChangeIndex(stats.changeIndex);
setRowCountLoaded(stats.rowCount);
}, },
[changeIndex] [changeIndex]
); );
@@ -85,6 +87,7 @@ export default function JslDataGridCore(props) {
loadDataPage={loadDataPage} loadDataPage={loadDataPage}
dataPageAvailable={dataPageAvailable} dataPageAvailable={dataPageAvailable}
loadRowCount={loadRowCount} loadRowCount={loadRowCount}
rowCountLoaded={rowCountLoaded}
loadNextDataToken={changeIndex} loadNextDataToken={changeIndex}
onReload={() => setChangeIndex(0)} onReload={() => setChangeIndex(0)}
griderFactory={RowsArrayGrider.factory} griderFactory={RowsArrayGrider.factory}

View File

@@ -14,6 +14,7 @@ export default function LoadingDataGridCore(props) {
griderFactory, griderFactory,
griderFactoryDeps, griderFactoryDeps,
onChangeGrider, onChangeGrider,
rowCountLoaded,
} = props; } = props;
const [loadProps, setLoadProps] = React.useState({ const [loadProps, setLoadProps] = React.useState({
@@ -131,7 +132,7 @@ export default function LoadingDataGridCore(props) {
isLoadedAll={isLoadedAll} isLoadedAll={isLoadedAll}
loadedTime={loadedTime} loadedTime={loadedTime}
exportGrid={exportGrid} exportGrid={exportGrid}
allRowCount={allRowCount} allRowCount={rowCountLoaded || allRowCount}
openQuery={openQuery} openQuery={openQuery}
isLoading={isLoading} isLoading={isLoading}
grider={grider} grider={grider}