ability to reset view when grid load error occurs

This commit is contained in:
Jan Prochazka
2022-06-23 09:08:43 +02:00
parent 1fb237417a
commit e9a8f3ee84
2 changed files with 11 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
import _ from 'lodash'; import _ from 'lodash';
import { GridConfig, GridCache, GridConfigColumns, createGridCache, GroupFunc } from './GridConfig'; import { GridConfig, GridCache, GridConfigColumns, createGridCache, GroupFunc, createGridConfig } from './GridConfig';
import { import {
ForeignKeyInfo, ForeignKeyInfo,
TableInfo, TableInfo,
@@ -445,6 +445,11 @@ export abstract class GridDisplay {
this.reload(); this.reload();
} }
resetConfig() {
this.setConfig(cfg => createGridConfig());
this.reload();
}
getChangeSetCondition(row) { getChangeSetCondition(row) {
if (!this.changeSetKeyFields) return null; if (!this.changeSetKeyFields) return null;
return _.pick(row, this.changeSetKeyFields); return _.pick(row, this.changeSetKeyFields);

View File

@@ -1485,7 +1485,11 @@
{#if !display || (!isDynamicStructure && (!columns || columns.length == 0))} {#if !display || (!isDynamicStructure && (!columns || columns.length == 0))}
<LoadingInfo wrapper message="Waiting for structure" /> <LoadingInfo wrapper message="Waiting for structure" />
{:else if errorMessage} {:else if errorMessage}
<ErrorInfo message={errorMessage} alignTop /> <div>
<ErrorInfo message={errorMessage} alignTop />
<FormStyledButton value="Reset filter" on:click={() => display.clearFilters()} />
<FormStyledButton value="Reset view" on:click={() => display.resetConfig()} />
</div>
{:else if isDynamicStructure && isLoadedAll && grider?.rowCount == 0} {:else if isDynamicStructure && isLoadedAll && grider?.rowCount == 0}
<div> <div>
<ErrorInfo <ErrorInfo