diff --git a/src/components/ui/VnFilterPanel.vue b/src/components/ui/VnFilterPanel.vue
index 0a306dc5f4..9cb5584678 100644
--- a/src/components/ui/VnFilterPanel.vue
+++ b/src/components/ui/VnFilterPanel.vue
@@ -65,18 +65,6 @@ onMounted(() => {
const isLoading = ref(false);
-async function search() {
- isLoading.value = true;
- const params = { ...userParams.value };
- const { params: newParams } = await arrayData.addFilter({ params });
- userParams.value = newParams;
-
- if (!props.showAll && !Object.values(params).length) store.data = [];
-
- isLoading.value = false;
- emit('search');
-}
-
async function reload() {
isLoading.value = true;
const params = Object.values(userParams.value).filter((param) => param);
@@ -87,6 +75,25 @@ async function reload() {
emit('refresh');
}
+async function search() {
+ isLoading.value = true;
+ const params = { ...userParams.value };
+ store.pagination = true;
+ store.filter.skip = 0;
+ store.skip = 0;
+ const { params: newParams } = await arrayData.addFilter({ params });
+ userParams.value = newParams;
+
+ if (!props.showAll && !Object.values(params).length) store.data = [];
+
+ isLoading.value = false;
+ emit('search');
+}
+async function remove(key) {
+ userParams.value[key] = null;
+ await search();
+ emit('remove', key);
+}
async function clearFilters() {
isLoading.value = true;
@@ -126,11 +133,7 @@ const customTags = computed(() =>
tagsList.value.filter((tag) => (props.customTags || []).includes(tag.label))
);
-async function remove(key) {
- userParams.value[key] = null;
- await search();
- emit('remove', key);
-}
+
function formatValue(value) {
if (typeof value === 'boolean') {
diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue
index ecebf89334..ea52a2943c 100644
--- a/src/components/ui/VnPaginate.vue
+++ b/src/components/ui/VnPaginate.vue
@@ -81,14 +81,13 @@ const store = arrayData.store;
onMounted(() => {
if (props.autoLoad) fetch();
});
-onUnmounted(async ()=>{
- arrayData.destroy()
-});
-watch(
- () => props.data,
+
+watch(()=>[props.data, store],
() => {
// store.skip = 0;
store.data = props.data;
+ if(store.pagination)
+ paginate()
}
);
@@ -187,7 +186,7 @@ async function onLoad(...params) {
v-if="store.data"
@load="onLoad"
:offset="offset"
- class="full-width full-height overflow-auto"
+ class="full-width full-height"
>