#7136 - Enable paginate event in VnSelectFilter #255

Closed
jsegarra wants to merge 86 commits from 7136_vnselectFilter_paginate into dev
3 changed files with 8 additions and 14 deletions
Showing only changes of commit 38e3e1c004 - Show all commits

View File

@ -79,22 +79,18 @@ async function paginate() {
pagination.value.page += 1;
}
async function fetch(fetchFilter = {}, options = { append: false }) {
async function fetch(fetchFilter = {}) {
try {
const filter = Object.assign(fetchFilter, $props.filter); // eslint-disable-line vue/no-dupe-keys
const filter = Object.assign(fetchFilter, $props.filter, $props.params); // eslint-disable-line vue/no-dupe-keys
if ($props.where && !fetchFilter.where) filter.where = $props.where;
if ($props.sortBy) filter.order = $props.sortBy;
if ($props.limit) filter.limit = $props.limit;
if ($props.skip) filter.skip = $props.skip;
const { data } = await axios.get($props.url, {
params: { filter: JSON.stringify(filter), ...$props.params },
});
pagination.value.hasMoreData = data.length === pagination.value.rowsPerPage;
await arrayData.applyFilter(filter);
Outdated
Review

Igual deberiamos sustiur el fetch por el fetch de arrayData y tambien al paginar usar el propio de arrayData
Asi duplicamos funcionalidad

Igual deberiamos sustiur el fetch por el fetch de arrayData y tambien al paginar usar el propio de arrayData Asi duplicamos funcionalidad

Revisado y refactorizado: 38e3e1c004

Revisado y refactorizado: 38e3e1c004f31ac26d439d4a74d765fd94d4a7c5
if (options.append) {
store.data.push(...data);
} else store.data = data;
const { data } = store;
pagination.value.hasMoreData = data.length === pagination.value.rowsPerPage;
emit('onFetch', data);

View File

@ -60,7 +60,7 @@ const $props = defineProps({
},
limit: {
type: [Number, String],
default: '4',
default: '30',
},
fetchRef: {
type: Object,
@ -161,9 +161,8 @@ watch(modelValue, (newValue) => {
const isLoading = ref(false);
async function onScroll(scrollEv) {
const { to, ref, direction } = scrollEv;
const { to, direction } = scrollEv;
const lastIndex = myOptions.value.length - 1;
const optionIndex = ref.getOptionIndex();
if (!$props.url && !$props.fetchRef) return;
if (direction === 'decrease') return;

View File

@ -80,8 +80,7 @@ export function useArrayData(key, userOptions) {
exprFilter = where ? { where } : null;
}
Object.assign(filter, store.userFilter, exprFilter);
Object.assign(store.filter, filter);
Object.assign(store.filter, filter, store.userFilter, exprFilter);
const params = {
filter: JSON.stringify(store.filter),
};