From d0524de01303989309714885523ade0b76fb028d Mon Sep 17 00:00:00 2001 From: Radu Liviu Carjan Date: Wed, 22 Sep 2021 16:53:54 +0300 Subject: [PATCH] Minor fix to searcher filters --- .../js/components/ProcessFile/ProcessFile.ts | 19 +++++++++++++++---- .../js/components/ProcessFile/ProcessFile.vue | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/resources/js/components/ProcessFile/ProcessFile.ts b/resources/js/components/ProcessFile/ProcessFile.ts index f9c08e8..cfa9838 100644 --- a/resources/js/components/ProcessFile/ProcessFile.ts +++ b/resources/js/components/ProcessFile/ProcessFile.ts @@ -60,10 +60,7 @@ export default class ProcessFile extends Vue { // private searchersData: Array<{ id: string; name: string; type: string; }> = []; // The list of filters applied to the selected searchers - private searchersFilters: any = { - name: '', - global: '' - }; + private searchersFilters: any = {}; // The list of selected filters/searchers private selectedSearchers: any = {}; @@ -566,6 +563,20 @@ export default class ProcessFile extends Vue { this.showDefineSearcher = false; } + /** + * Watch the filters for any changes. When the search value is empty, remove it + * This is needed due to a bug in PrimeVue where the pagination doesn't work when there is a active filter + * + * @param newValue + * @param oldValue + */ + @Watch('searchersFilters', { deep: true }) + private onFiltersChanged(newValue: any, oldValue: object): void { + if (newValue.global === '') { + this.searchersFilters = {}; + } + } + /** * Watch the `showDiffHighlight` property for changes * diff --git a/resources/js/components/ProcessFile/ProcessFile.vue b/resources/js/components/ProcessFile/ProcessFile.vue index 2dcbdbe..ecd3093 100644 --- a/resources/js/components/ProcessFile/ProcessFile.vue +++ b/resources/js/components/ProcessFile/ProcessFile.vue @@ -193,7 +193,7 @@ {{slotProps.data.name}}