mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
query data refresh
This commit is contained in:
parent
5df0204450
commit
f10f863940
@ -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() {
|
||||
|
@ -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 @@
|
||||
|
||||
<ToolStripContainer>
|
||||
{#if jslid}
|
||||
<JslDataGrid {jslid} listenInitializeFile />
|
||||
<JslDataGrid {jslid} listenInitializeFile onCustomGridRefresh={handleRefresh} focusOnVisible />
|
||||
{:else}
|
||||
<LoadingInfo message="Loading data..." />
|
||||
{/if}
|
||||
|
Loading…
Reference in New Issue
Block a user