mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 03:06:00 +00:00
load query data fix
This commit is contained in:
@@ -164,7 +164,7 @@
|
||||
import axios from '../utility/axios';
|
||||
import { copyTextToClipboard } from '../utility/clipboard';
|
||||
|
||||
export let loadNextData = undefined;
|
||||
export let onLoadNextData = undefined;
|
||||
export let grider = undefined;
|
||||
export let display: GridDisplay = undefined;
|
||||
export let conid = undefined;
|
||||
@@ -286,6 +286,12 @@
|
||||
copyTextToClipboard(text);
|
||||
}
|
||||
|
||||
export function loadNextDataIfNeeded() {
|
||||
if (onLoadNextData && firstVisibleRowScrollIndex + visibleRowCountUpperBound >= grider.rowCount) {
|
||||
onLoadNextData();
|
||||
}
|
||||
}
|
||||
|
||||
$: autofillMarkerCell =
|
||||
selectedCells && selectedCells.length > 0 && _.uniq(selectedCells.map(x => x[0])).length == 1
|
||||
? [_.max(selectedCells.map(x => x[0])), _.max(selectedCells.map(x => x[1]))]
|
||||
@@ -326,8 +332,8 @@
|
||||
$: maxScrollColumn = columnSizes.scrollInView(0, columns.length - 1 - columnSizes.frozenCount, gridScrollAreaWidth);
|
||||
|
||||
$: {
|
||||
if (loadNextData && firstVisibleRowScrollIndex + visibleRowCountUpperBound >= grider.rowCount) {
|
||||
loadNextData();
|
||||
if (onLoadNextData && firstVisibleRowScrollIndex + visibleRowCountUpperBound >= grider.rowCount && rowHeight > 0) {
|
||||
onLoadNextData();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
let changeIndex = 0;
|
||||
let rowCountLoaded = null;
|
||||
|
||||
const throttleLoadNext = _.throttle(() => domGrid.loadNextData(), 500);
|
||||
const throttleLoadNext = _.throttle(() => domGrid.resetLoadedAll(), 500);
|
||||
|
||||
const handleJslDataStats = stats => {
|
||||
if (stats.changeIndex < changeIndex) return;
|
||||
|
||||
@@ -15,15 +15,22 @@
|
||||
let loadedTime = new Date().getTime();
|
||||
let allRowCount = null;
|
||||
let errorMessage = null;
|
||||
let domGrid;
|
||||
|
||||
const loadNextDataRef = { current: false };
|
||||
const loadedTimeRef = { current: null };
|
||||
|
||||
export function resetLoadedAll() {
|
||||
isLoadedAll = false;
|
||||
domGrid.loadNextDataIfNeeded();
|
||||
}
|
||||
|
||||
const handleLoadRowCount = async () => {
|
||||
const rowCount = await loadRowCount($$props);
|
||||
allRowCount = rowCount;
|
||||
};
|
||||
|
||||
export async function loadNextData() {
|
||||
async function loadNextData() {
|
||||
if (isLoading) return;
|
||||
loadNextDataRef.current = false;
|
||||
isLoading = true;
|
||||
@@ -102,8 +109,9 @@
|
||||
</script>
|
||||
|
||||
<DataGridCore
|
||||
bind:this={domGrid}
|
||||
{...$$props}
|
||||
loadNextData={handleLoadNextData}
|
||||
onLoadNextData={handleLoadNextData}
|
||||
{grider}
|
||||
{isLoading}
|
||||
{allRowCount}
|
||||
|
||||
Reference in New Issue
Block a user