fix mongo reload - using setLoadedRows instead of bind:loadedRows

This commit is contained in:
Jan Prochazka 2024-05-24 10:47:38 +02:00
parent 5fe55af3b7
commit e04da15f72
8 changed files with 40 additions and 13 deletions

View File

@ -136,10 +136,11 @@
export let macroPreview;
export let macroValues;
export let selectedCellsPublished;
export let setLoadedRows = null;
// export let onChangeGrider = undefined;
export let loadedRows = [];
let loadedRows = [];
export const activator = createActivator('CollectionDataGridCore', false);
@ -225,6 +226,11 @@
...createQuickExportMenu(quickExportHandler, { command: 'collectionDataGrid.export' }),
tag: 'export',
}));
function handleSetLoadedRows(rows) {
loadedRows = rows;
if (setLoadedRows) setLoadedRows(rows);
}
</script>
<LoadingDataGridCore
@ -232,7 +238,7 @@
loadDataPage={loadCollectionDataPage}
{dataPageAvailable}
{loadRowCount}
bind:loadedRows
setLoadedRows={handleSetLoadedRows}
bind:selectedCellsPublished
frameSelection={!!macroPreview}
onOpenQuery={openQuery}

View File

@ -88,8 +88,9 @@
export let macroCondition;
export let onRunMacro;
export let hasMultiColumnFilter = false;
export let setLoadedRows = null;
export let loadedRows;
let loadedRows;
export const activator = createActivator('DataGrid', false);
@ -208,7 +209,7 @@
{#if isFormView}
<svelte:component this={formViewComponent} {...$$props} />
{:else if isJsonView}
<svelte:component this={jsonViewComponent} {...$$props} bind:loadedRows />
<svelte:component this={jsonViewComponent} {...$$props} {setLoadedRows} />
{:else}
<svelte:component
this={gridCoreComponent}
@ -217,7 +218,7 @@
formViewAvailable={!!formViewComponent}
macroValues={extractMacroValuesForMacro($macroValues, $selectedMacro)}
macroPreview={$selectedMacro}
bind:loadedRows
{setLoadedRows}
bind:selectedCellsPublished
onChangeSelectedColumns={cols => {
if (domColumnManager) domColumnManager.setSelectedColumns(cols);

View File

@ -70,6 +70,10 @@
supportsReload,
!!changeSetState
);
function handleSetLoadedRows(rows) {
loadedRows = rows;
}
</script>
{#key jslid}
@ -81,7 +85,7 @@
setConfig={config.update}
gridCoreComponent={JslDataGridCore}
formViewComponent={JslFormView}
bind:loadedRows
setLoadedRows={handleSetLoadedRows}
isDynamicStructure={!!infoUsed?.__isDynamicStructure}
useEvalFilters
showMacros={!!dispatchChangeSet}

View File

@ -72,7 +72,7 @@
export let selectedCellsPublished = () => [];
export const activator = createActivator('JslDataGridCore', false);
export let loadedRows = [];
let loadedRows = [];
let domGrid;
let changeIndex = 0;
@ -186,12 +186,16 @@
...createQuickExportMenu(quickExportHandler, { command: 'jslTableGrid.export' }),
tag: 'export',
}));
function handleSetLoadedRows(rows) {
loadedRows = rows;
}
</script>
<LoadingDataGridCore
bind:this={domGrid}
{...$$props}
bind:loadedRows
setLoadedRows={handleSetLoadedRows}
bind:selectedCellsPublished
{loadDataPage}
{dataPageAvailable}

View File

@ -16,10 +16,11 @@
export let rowCountLoaded = null;
export let preprocessLoadedRow = null;
export let setLoadedRows = null;
// export let griderFactory;
export let loadedRows = [];
let loadedRows = [];
let isLoading = false;
let isLoadedAll = false;
let loadedTime = new Date().getTime();
@ -49,7 +50,6 @@
// await new Promise(resolve => setTimeout(resolve, 5000));
loadedTimeRef.set(loadStart);
// console.log('LOAD NEXT ROWS', loadedRows);
const nextRows = await loadDataPage(
$$props,
@ -121,6 +121,8 @@
display.reload();
}
}
$: if (setLoadedRows) setLoadedRows(loadedRows);
</script>
<DataGridCore

View File

@ -212,6 +212,10 @@
tag: 'export',
})
);
function handleSetLoadedRows(rows) {
loadedRows = rows;
}
</script>
<LoadingDataGridCore
@ -219,7 +223,7 @@
{loadDataPage}
{dataPageAvailable}
{loadRowCount}
bind:loadedRows
setLoadedRows={handleSetLoadedRows}
bind:selectedCellsPublished
frameSelection={!!macroPreview}
{grider}

View File

@ -25,13 +25,14 @@
export let changeSetState;
export let dispatchChangeSet;
export let setLoadedRows;
export const activator = createActivator('CollectionJsonView', true);
let isLoading = false;
let loadedTime = null;
export let loadedRows = [];
let loadedRows = [];
let skip = 0;
let limit = 50;
@ -39,6 +40,7 @@
isLoading = true;
// @ts-ignore
loadedRows = await loadCollectionDataPage($$props, parseInt(skip) || 0, parseInt(limit) || 50);
if (setLoadedRows) setLoadedRows(loadedRows);
isLoading = false;
loadedTime = new Date().getTime();
}

View File

@ -167,11 +167,15 @@
$: setLocalStorage('collection_collapsedLeftColumn', $collapsedLeftColumnStore);
const quickExportHandlerRef = createQuickExportHandlerRef();
function handleSetLoadedRows(rows) {
loadedRows = rows;
}
</script>
<ToolStripContainer>
<DataGrid
bind:loadedRows
setLoadedRows={handleSetLoadedRows}
{...$$props}
config={$config}
setConfig={config.update}