Browse Source

Merge pull request #3888 from nocodb/fix/3887-shared-grid-csv-download

Fix: Shared grid - csv/excel export with filter and sort
pull/3894/head
Raju Udava 2 years ago committed by GitHub
parent
commit
c596ae3718
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      packages/nc-gui/components/smartsheet/toolbar/ExportSubActions.vue
  2. 6
      packages/nc-gui/composables/useSharedView.ts

5
packages/nc-gui/components/smartsheet/toolbar/ExportSubActions.vue

@ -45,7 +45,10 @@ const exportFile = async (exportType: ExportTypes) => {
let res let res
if (isPublicView.value) { if (isPublicView.value) {
const { exportFile: sharedViewExportFile } = useSharedView() const { exportFile: sharedViewExportFile } = useSharedView()
res = await sharedViewExportFile(fields.value, offset, exportType, responseType) res = await sharedViewExportFile(fields.value, offset, exportType, responseType, {
sortsArr: sorts.value,
filtersArr: nestedFilters.value,
})
} else { } else {
res = await $api.dbViewRow.export( res = await $api.dbViewRow.export(
'noco', 'noco',

6
packages/nc-gui/composables/useSharedView.ts

@ -89,15 +89,15 @@ export function useSharedView() {
offset: number, offset: number,
type: ExportTypes.EXCEL | ExportTypes.CSV, type: ExportTypes.EXCEL | ExportTypes.CSV,
responseType: 'base64' | 'blob', responseType: 'base64' | 'blob',
{ sortsArr, filtersArr }: { sortsArr: SortType[]; filtersArr: FilterType[] },
) => { ) => {
return await $api.public.csvExport(sharedView.value!.uuid!, type, { return await $api.public.csvExport(sharedView.value!.uuid!, type, {
format: responseType, format: responseType,
query: { query: {
fields: fields.map((field) => field.title), fields: fields.map((field) => field.title),
offset, offset,
sortArrJson: JSON.stringify(sorts.value), filterArrJson: JSON.stringify(filtersArr ?? nestedFilters.value),
sortArrJson: JSON.stringify(sortsArr ?? sorts.value),
filterArrJson: JSON.stringify(nestedFilters.value),
}, },
headers: { headers: {
'xc-password': password.value, 'xc-password': password.value,

Loading…
Cancel
Save