diff --git a/src/components/ui/VnFilterPanel.vue b/src/components/ui/VnFilterPanel.vue
index 9cb558467..6b6960243 100644
--- a/src/components/ui/VnFilterPanel.vue
+++ b/src/components/ui/VnFilterPanel.vue
@@ -79,6 +79,7 @@ async function search() {
isLoading.value = true;
const params = { ...userParams.value };
store.pagination = true;
+ store.userParamsChanged = true;
store.filter.skip = 0;
store.skip = 0;
const { params: newParams } = await arrayData.addFilter({ params });
@@ -87,6 +88,8 @@ async function search() {
if (!props.showAll && !Object.values(params).length) store.data = [];
isLoading.value = false;
+ // store.pagination = false;
+
emit('search');
}
async function remove(key) {
@@ -96,10 +99,11 @@ async function remove(key) {
}
async function clearFilters() {
isLoading.value = true;
+ store.userParamsChanged = true;
// Filtrar los params no removibles
const removableFilters = Object.keys(userParams.value).filter((param) =>
- props.unremovableParams.includes(param)
+ props.unremovableParams.includes(param)
);
const newParams = {};
// Conservar solo los params que no son removibles
diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue
index ea52a2943..dfb19ed88 100644
--- a/src/components/ui/VnPaginate.vue
+++ b/src/components/ui/VnPaginate.vue
@@ -1,5 +1,12 @@
@@ -183,6 +210,7 @@ async function onLoad(...params) {
0) {
+ hasMoreData.value = true;
+ } else if(store.userParamsChanged){
+ hasMoreData.value = false;
}
+ else */hasMoreData.value = response.data.length === limit;
+ // if (store.pagination) {
+ // console.error('Before-ArrayData', store.pagination, hasMoreData.value)
+ // hasMoreData.value = true;
+ // console.error('After-ArrayData', store.pagination, hasMoreData.value)
+ // }
if (append) {
if (!store.data) store.data = [];
for (const row of response.data) store.data.push(row);
@@ -182,6 +188,7 @@ export function useArrayData(key, userOptions) {
async function loadMore() {
if (!hasMoreData.value) return;
+ console.error('loadMore', hasMoreData.value);
store.skip = store.limit * page.value;
page.value += 1;
@@ -200,7 +207,7 @@ export function useArrayData(key, userOptions) {
if (store.skip) query.skip = store.skip;
if (store.userParams && Object.keys(store.userParams).length !== 0)
query.params = JSON.stringify(store.userParams);
-
+ // hasMoreData.value = true;
if (router)
router.replace({
path: route.path,
diff --git a/src/stores/useArrayDataStore.js b/src/stores/useArrayDataStore.js
index 94e772a87..c8cd349e0 100644
--- a/src/stores/useArrayDataStore.js
+++ b/src/stores/useArrayDataStore.js
@@ -21,6 +21,7 @@ export const useArrayDataStore = defineStore('arrayDataStore', () => {
isLoading: false,
loadMore: false,
pagination: false,
+ userParamsChanged: true,
exprBuilder: null,
};
}