(core) Download as CSV button on sections

Summary: Adding "Download as CSV" button that exports filtred section data to csv

Test Plan: Browser tests

Reviewers: paulfitz, dsagal

Reviewed By: paulfitz

Differential Revision: https://phab.getgrist.com/D2830
This commit is contained in:
Jarosław Sadziński
2021-05-27 13:06:26 +02:00
parent 5c0494fe29
commit 96fee73b70
14 changed files with 311 additions and 185 deletions

View File

@@ -576,13 +576,19 @@ export class GristDoc extends DisposableWithEvents {
}
public getCsvLink() {
return this.docComm.docUrl('gen_csv') + '?' + encodeQueryParams({
const filters = this.viewModel.activeSection.peek().filteredFields.get().map(field=> ({
colRef : field.colRef.peek(),
filter : field.activeFilter.peek()
}));
const params = {
...this.docComm.getUrlParams(),
title: this.docPageModel.currentDocTitle.get(),
viewSection: this.viewModel.activeSectionId(),
tableId: this.viewModel.activeSection().table().tableId(),
activeSortSpec: JSON.stringify(this.viewModel.activeSection().activeSortSpec())
});
activeSortSpec: JSON.stringify(this.viewModel.activeSection().activeSortSpec()),
filters : JSON.stringify(filters),
};
return this.docComm.docUrl('gen_csv') + '?' + encodeQueryParams(params);
}
public hasGranularAccessRules(): boolean {