diff --git a/zero.Backoffice.UI/app/components/ui-table.vue b/zero.Backoffice.UI/app/components/ui-table.vue index 65273fa6..e71c8446 100644 --- a/zero.Backoffice.UI/app/components/ui-table.vue +++ b/zero.Backoffice.UI/app/components/ui-table.vue @@ -271,10 +271,8 @@ { if (!this.listConfig.noQueryString) { - //const query = Qs.stringify(this.listConfig.paramsToQuery(this.query)); - //const path = this.$route.href.split('?')[0] + (query ? '?' + query : ''); - //history.replaceState({}, null, path); - this.$router.replace({ path: this.$route.path, params: this.$route.params, query: this.listConfig.paramsToQuery(this.query) }) + const query = this.listConfig.paramsToQuery(this.query, true); + this.$router.replace({ path: this.$route.path, params: this.$route.params, query }) } else { diff --git a/zero.Backoffice.UI/app/schemas/list/list.ts b/zero.Backoffice.UI/app/schemas/list/list.ts index 032777d1..0a34dc6f 100644 --- a/zero.Backoffice.UI/app/schemas/list/list.ts +++ b/zero.Backoffice.UI/app/schemas/list/list.ts @@ -84,9 +84,10 @@ class List implements ZeroSchema /** * Converts the list parameters (like page, search, filter, ...) to a vue router query */ - paramsToQuery = params => + paramsToQuery = (params: any, mergeWithUrlQuery: boolean = false) => { let values: any = {}; + let reserved = ['page', 'by', 'desc', 'search', 'filter', 'orderBy', 'isDescending']; if (params.page !== this.query.page) { @@ -106,6 +107,18 @@ class List implements ZeroSchema values.filter = params.filter.id; } + if (mergeWithUrlQuery) + { + var urlParams = new URLSearchParams(location.search); + urlParams.forEach((value, key) => + { + if (reserved.indexOf(key) < 0) + { + values[key] = value; + } + }); + } + return values; };