#8207 hotfix-tableActions #991

Merged
jorgep merged 11 commits from 8207-hotfix-tableActions into master 2024-11-25 11:13:45 +00:00
3 changed files with 12 additions and 13 deletions
Showing only changes of commit 7048f96565 - Show all commits

View File

@ -130,10 +130,10 @@ const addFilter = async (filter, params) => {
await arrayData.addFilter({ filter, params });
};
async function fetch(params) {
async function fetch(params, keepRowsNumber = false) {
jorgep marked this conversation as resolved Outdated
Outdated
Review

Yo haria algo mas asi:

async function fetch(params) {
    useArrayData(props.dataKey, params);
    arrayData.reset(['filter.skip', 'skip']);
    await arrayData.fetch({ append: false });

    endFetch();
}

async function refresh(params) {
    useArrayData(props.dataKey, params);

    const { limit, skip } = store;
    store.limit = limit + skip;
    store.skip = 0;
    await arrayData.fetch({ append: false });
    store.limit = limit;
    store.skip = skip;

    endFetch();
}

function endFetch() {
    if (!store.hasMoreData) isLoading.value = false;

    emit('onFetch', store.data);
    return store.data;
}
Yo haria algo mas asi: ``` async function fetch(params) { useArrayData(props.dataKey, params); arrayData.reset(['filter.skip', 'skip']); await arrayData.fetch({ append: false }); endFetch(); } async function refresh(params) { useArrayData(props.dataKey, params); const { limit, skip } = store; store.limit = limit + skip; store.skip = 0; await arrayData.fetch({ append: false }); store.limit = limit; store.skip = skip; endFetch(); } function endFetch() { if (!store.hasMoreData) isLoading.value = false; emit('onFetch', store.data); return store.data; } ```
useArrayData(props.dataKey, params);
arrayData.reset(['filter.skip', 'skip', 'page']);
await arrayData.fetch({ append: false });
if (!keepRowsNumber) arrayData.reset(['filter.skip', 'skip', 'page']);
await arrayData.fetch({ append: false, keepRowsNumber });
if (!store.hasMoreData) isLoading.value = false;
emit('onFetch', store.data);

View File

@ -64,7 +64,11 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
}
}
async function fetch({ append = false, updateRouter = true, totalRows = null }) {
async function fetch({
append = false,
updateRouter = true,
keepRowsNumber = false,
}) {
if (!store.url) return;
cancelRequest();
@ -107,8 +111,9 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) {
if (params.filter.where || exprFilter)
params.filter.where = { ...params.filter.where, ...exprFilter };
if (totalRows) {
params.filter.limit = totalRows;
if (keepRowsNumber) {
const { limit, skip } = store;
params.filter.limit = limit + skip;
params.filter.skip = 0;
}
params.filter = JSON.stringify(params.filter);

View File

@ -354,13 +354,7 @@ const openTab = (id) =>
class="q-mr-sm"
dense
flat
@click="
() => {
const { limit, skip } = arrayData.store;
const nlimit = limit + skip;
arrayData.fetch({ totalRows: nlimit });
}
"
@click="tableRef.CrudModelRef.vnPaginateRef.fetch(undefined, true)"
>
<QTooltip>{{ $t('globals.refresh') }}</QTooltip>
</QBtn>