diff --git a/zero.Backoffice.UI/app/components/ui-table-filter-overlay.vue b/zero.Backoffice.UI/app/components/ui-table-filter-overlay.vue
index 0af5c347..8ed4e689 100644
--- a/zero.Backoffice.UI/app/components/ui-table-filter-overlay.vue
+++ b/zero.Backoffice.UI/app/components/ui-table-filter-overlay.vue
@@ -9,7 +9,7 @@
-
+
diff --git a/zero.Backoffice.UI/app/components/ui-table-filter.vue b/zero.Backoffice.UI/app/components/ui-table-filter.vue
index 0d8d4619..7abfa5dd 100644
--- a/zero.Backoffice.UI/app/components/ui-table-filter.vue
+++ b/zero.Backoffice.UI/app/components/ui-table-filter.vue
@@ -101,6 +101,18 @@
this.storedFilters = this.getStoredFilters();
this.actions = this.attach.listConfig.actions;
+ let filterId = this.$route.query['filter'];
+
+ if (filterId)
+ {
+ let filter = this.storedFilters.find(x => x.id === filterId);
+
+ if (filter)
+ {
+ this.setFilter(filter);
+ }
+ }
+
this.loaded = true;
},
@@ -124,7 +136,7 @@
// set the current filter
- setFilter(value, two)
+ setFilter(value)
{
if (!value)
{
diff --git a/zero.Backoffice.UI/app/components/ui-table.vue b/zero.Backoffice.UI/app/components/ui-table.vue
index bd8e0103..65273fa6 100644
--- a/zero.Backoffice.UI/app/components/ui-table.vue
+++ b/zero.Backoffice.UI/app/components/ui-table.vue
@@ -98,6 +98,7 @@
}
}
+ const FILTER_KEY_PREFIX = 'zero.ui-table-filter.';
export default defineComponent({
name: 'uiTable',
@@ -122,6 +123,7 @@
listConfig: {},
columns: [],
query: {},
+ alias: null,
filter: null,
items: [],
@@ -164,6 +166,7 @@
{
this.debouncedUpdate = debounce(this.update, 300);
const schema = typeof this.config === 'string' ? await this.zero.getSchema(this.config) : this.config;
+ this.alias = schema.alias;
this.listConfig = compileList(this.zero, schema);
this.itemComponentConfig = this.listConfig.componentConfig || { active: false };
//this.listConfig.selectable = true;
@@ -187,6 +190,18 @@
this.query = { ...this.listConfig.query, ...this.listConfig.queryToParams(this.$route.query) };
this.component = !!this.listConfig.link ? 'router-link' : (!!this.listConfig.onClick ? 'button' : 'div');
this.filter = { ...this.listConfig.filterOptions };
+
+ if (this.query.filter && this.query.filter.id)
+ {
+ let filters = this.getStoredFilters();
+ let filter = filters.find(x => x.id === this.query.filter.id);
+
+ if (filter)
+ {
+ this.query.filter = { ...filter.filter, id: filter.id };
+ }
+ }
+
this.$nextTick(() =>
{
this.loaded = true;
@@ -230,6 +245,17 @@
},
+ // load stored filters from local storage
+ getStoredFilters()
+ {
+ if (!this.filter.editor)
+ {
+ return [];
+ }
+ return JSON.parse(localStorage.getItem(FILTER_KEY_PREFIX + this.filter.editor.alias) || "[]");
+ },
+
+
// updates the list (debounced)
async update()
{
@@ -295,7 +321,6 @@
// set a new filter
setFilter(filter)
{
- console.info('filter', filter);
this.query.filter = filter;
this.onChange();
},
diff --git a/zero.Backoffice.UI/app/schemas/list/list.ts b/zero.Backoffice.UI/app/schemas/list/list.ts
index a3ec4ae7..032777d1 100644
--- a/zero.Backoffice.UI/app/schemas/list/list.ts
+++ b/zero.Backoffice.UI/app/schemas/list/list.ts
@@ -105,6 +105,7 @@ class List implements ZeroSchema
{
values.filter = params.filter.id;
}
+
return values;
};