data grid optimalization

This commit is contained in:
Jan Prochazka
2022-02-10 10:30:22 +01:00
parent 253ec934ed
commit e8404114bb
4 changed files with 29 additions and 14 deletions

View File

@@ -121,14 +121,15 @@
</script>
<DataGridCore
bind:this={domGrid}
{...$$props}
bind:this={domGrid}
bind:selectedCellsPublished
onLoadNextData={handleLoadNextData}
{errorMessage}
{grider}
{isLoading}
allRowCount={rowCountLoaded || allRowCount}
{isLoadedAll}
{loadedTime}
bind:selectedCellsPublished
{grider}
{display}
/>

View File

@@ -100,16 +100,29 @@
let loadedRows = [];
let grider;
// $: console.log('loadedRows BIND', loadedRows);
$: grider = new ChangeSetGrider(
loadedRows,
changeSetState,
dispatchChangeSet,
display,
macroPreview,
macroValues,
selectedCellsPublished()
);
$: {
if (macroPreview) {
grider = new ChangeSetGrider(
loadedRows,
changeSetState,
dispatchChangeSet,
display,
macroPreview,
macroValues,
selectedCellsPublished()
);
}
}
// prevent recreate grider, if no macro is selected, so there is no need to selectedcells in macro
$: {
if (!macroPreview) {
grider = new ChangeSetGrider(loadedRows, changeSetState, dispatchChangeSet, display);
}
}
// $: console.log('GRIDER', grider);
// $: if (onChangeGrider) onChangeGrider(grider);
@@ -200,4 +213,5 @@
bind:selectedCellsPublished
frameSelection={!!macroPreview}
{grider}
{display}
/>

View File

@@ -58,8 +58,6 @@
const childCache = writable(createGridCache());
// $: console.log('display', display);
$: display =
connection && $serverVersion
? new TableGridDisplay(

View File

@@ -6,6 +6,8 @@ import Grider from './Grider';
import { isJsonLikeLongString, safeJsonParse } from 'dbgate-tools';
export function countColumnSizes(grider: Grider, columns, containerWidth, display: GridDisplay) {
// console.log('COUNT SIZES');
const columnSizes = new SeriesSizes();
if (!grider || !columns || !display) return columnSizes;