diff --git a/packages/web/src/datagrid/DataGridCore.svelte b/packages/web/src/datagrid/DataGridCore.svelte index 0a5aa85f..e23894b2 100644 --- a/packages/web/src/datagrid/DataGridCore.svelte +++ b/packages/web/src/datagrid/DataGridCore.svelte @@ -9,7 +9,7 @@ toolbar: true, isRelatedToTab: true, icon: 'icon reload', - testEnabled: () => getCurrentDataGrid()?.getDisplay()?.supportsReload, + testEnabled: () => getCurrentDataGrid()?.canRefresh(), onClick: () => getCurrentDataGrid().refresh(), }); @@ -334,6 +334,7 @@ export let collapsedLeftColumnStore; export let multipleGridsOnTab = false; export let tabControlHiddenTab = false; + export let onCustomGridRefresh; // export let generalAllowSave = false; export const activator = createActivator('DataGridCore', false); @@ -362,7 +363,13 @@ const tabid = getContext('tabid'); export function refresh() { - display.reload(); + if (onCustomGridRefresh) onCustomGridRefresh(); + else display.reload(); + } + + export function canRefresh() { + if (onCustomGridRefresh) return true; + return getDisplay()?.supportsReload; } export function getGrider() { diff --git a/packages/web/src/tabs/QueryDataTab.svelte b/packages/web/src/tabs/QueryDataTab.svelte index 53e48f06..4c1b794c 100644 --- a/packages/web/src/tabs/QueryDataTab.svelte +++ b/packages/web/src/tabs/QueryDataTab.svelte @@ -21,10 +21,21 @@ let jslid; async function loadData(conid, database, sql) { - const resp = await apiCall('sessions/execute-reader', { conid, database, sql, appFolder: schemaName, queryName: pureName }); + const resp = await apiCall('sessions/execute-reader', { + conid, + database, + sql, + appFolder: schemaName, + queryName: pureName, + }); jslid = resp.jslid; } + function handleRefresh() { + jslid = null; + loadData(conid, database, sql) + } + const quickExportHandlerRef = createQuickExportHandlerRef(); $: loadData(conid, database, sql); @@ -32,7 +43,7 @@ {#if jslid} - + {:else} {/if}