diff --git a/packages/nc-gui/components/smartsheet/Gallery.vue b/packages/nc-gui/components/smartsheet/Gallery.vue index 9b636913ab..f6064dd30f 100644 --- a/packages/nc-gui/components/smartsheet/Gallery.vue +++ b/packages/nc-gui/components/smartsheet/Gallery.vue @@ -174,9 +174,18 @@ reloadViewMetaHook?.on(async () => { reloadAttachments.value = false }) }) -reloadViewDataHook?.on(async () => { - await loadData() -}) +reloadViewDataHook?.on( + async ( + params: void | { + shouldShowLoading?: boolean | undefined + offset?: number | undefined + }, + ) => { + await loadData({ + ...(params?.offset !== undefined ? { offset: params.offset } : {}), + }) + }, +) // provide view data reload hook as fallback to row data reload provide(ReloadRowDataHookInj, reloadViewDataHook) diff --git a/packages/nc-gui/components/smartsheet/grid/GroupBy.vue b/packages/nc-gui/components/smartsheet/grid/GroupBy.vue index b76fddb217..0e30a42b1a 100644 --- a/packages/nc-gui/components/smartsheet/grid/GroupBy.vue +++ b/packages/nc-gui/components/smartsheet/grid/GroupBy.vue @@ -12,7 +12,7 @@ const props = defineProps<{ group: Group loadGroups: (params?: any, group?: Group) => Promise - loadGroupData: (group: Group, force?: boolean) => Promise + loadGroupData: (group: Group, force?: boolean, params?: any) => Promise loadGroupPage: (group: Group, p: number) => Promise groupWrapperChangePage: (page: number, groupWrapper?: Group) => Promise @@ -80,11 +80,13 @@ const findAndLoadSubGroup = (key: any) => { oldActiveGroups.value = key } -const reloadViewDataHandler = () => { +const reloadViewDataHandler = (params: void | { shouldShowLoading?: boolean | undefined; offset?: number | undefined }) => { if (vGroup.value.nested) { - props.loadGroups({}, vGroup.value) + props.loadGroups({ ...(params?.offset !== undefined ? { offset: params.offset } : {}) }, vGroup.value) } else { - props.loadGroupData(vGroup.value, true) + props.loadGroupData(vGroup.value, true, { + ...(params?.offset !== undefined ? { offset: params.offset } : {}), + }) } } diff --git a/packages/nc-gui/components/smartsheet/grid/GroupByTable.vue b/packages/nc-gui/components/smartsheet/grid/GroupByTable.vue index 296746fd20..b6a08955ac 100644 --- a/packages/nc-gui/components/smartsheet/grid/GroupByTable.vue +++ b/packages/nc-gui/components/smartsheet/grid/GroupByTable.vue @@ -8,7 +8,7 @@ const props = defineProps<{ group: Group loadGroups: (params?: any, group?: Group) => Promise - loadGroupData: (group: Group, force?: boolean) => Promise + loadGroupData: (group: Group, force?: boolean, params?: any) => Promise loadGroupPage: (group: Group, p: number) => Promise groupWrapperChangePage: (page: number, groupWrapper?: Group) => Promise @@ -87,8 +87,10 @@ const { deleteRow, deleteSelectedRows, deleteRangeOfRows, updateOrSaveRow, bulkU }, }) -const reloadTableData = async () => { - await props.loadGroupData(vGroup.value, true) +const reloadTableData = async (params: void | { shouldShowLoading?: boolean | undefined; offset?: number | undefined }) => { + await props.loadGroupData(vGroup.value, true, { + ...(params?.offset !== undefined ? { offset: params.offset } : {}), + }) } onBeforeUnmount(async () => { diff --git a/packages/nc-gui/components/smartsheet/grid/Table.vue b/packages/nc-gui/components/smartsheet/grid/Table.vue index 95c7b8426b..9bdbd8e333 100644 --- a/packages/nc-gui/components/smartsheet/grid/Table.vue +++ b/packages/nc-gui/components/smartsheet/grid/Table.vue @@ -56,7 +56,7 @@ import type { CellRange, Row } from '#imports' const props = defineProps<{ data: Row[] paginationData?: PaginatedType - loadData?: (params?: unknown) => Promise + loadData?: (params?: any) => Promise changePage?: (page: number) => void callAddEmptyRow?: (addAfter?: number) => Row | undefined deleteRow?: (rowIndex: number, undo?: boolean) => Promise diff --git a/packages/nc-gui/composables/useViewGroupBy.ts b/packages/nc-gui/composables/useViewGroupBy.ts index 4919757bd2..739b33fcc4 100644 --- a/packages/nc-gui/composables/useViewGroupBy.ts +++ b/packages/nc-gui/composables/useViewGroupBy.ts @@ -295,7 +295,7 @@ export const useViewGroupBy = (view: Ref, where?: Computed } } - async function loadGroupData(group: Group, force = false) { + async function loadGroupData(group: Group, force = false, params: any = {}) { if (!base?.value?.id || !view.value?.id || !view.value?.fk_model_id) return if (group.children && !force) return @@ -315,6 +315,7 @@ export const useViewGroupBy = (view: Ref, where?: Computed const response = !isPublic.value ? await api.dbViewRow.list('noco', base.value.id, view.value.fk_model_id, view.value.id, { ...query, + ...params, ...(isUIAllowed('sortSync') ? {} : { sortArrJson: JSON.stringify(sorts.value) }), ...(isUIAllowed('filterSync') ? {} : { filterArrJson: JSON.stringify(nestedFilters.value) }), } as any)