Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export to Excel and CSV #216

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/vre/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.13/js/select2.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/backbone-min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/js/tabulator.min.js"></script>
<script src="https://cdn.sheetjs.com/xlsx-0.20.3/package/dist/xlsx.mini.min.js"></script>
<script src="/static/bundle.js"></script>
</body>
</html>
10 changes: 10 additions & 0 deletions frontend/vre/record/record.list.managing.view.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export var RecordListManagingView = CompositeView.extend({
this.vreCollectionsSelect.submitForm(event, selection);
},
'click .more-records': 'loadMore',
'click .download-xlsx': 'downloadXLSX',
'click .download-csv': 'downloadCSV',
},

initialize: function(options) {
Expand All @@ -39,4 +41,12 @@ export var RecordListManagingView = CompositeView.extend({
loadMore: function(event) {
this.collection.trigger('moreRequested', event);
},

downloadXLSX: function() {
this.recordListView.downloadXLSX();
},

downloadCSV: function() {
this.recordListView.downloadCSV();
},
});
6 changes: 5 additions & 1 deletion frontend/vre/record/record.list.managing.view.mustache
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
<h4 id="search-feedback"></h4>
<a href="#" class="more-records">Load more records</a>
<ul class="inline-list">
<li><a href="#" class="more-records">Load more records</a></li>
<li><a href="#" class="download-xlsx">Download XLSX</a></li>
<li><a href="#" class="download-csv">Download CSV</a></li>
</ul>
8 changes: 8 additions & 0 deletions frontend/vre/record/record.list.view.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,12 @@ export var RecordListView = Backbone.View.extend({
this.table.replaceData(data);
}
},

downloadXLSX: function() {
this.table.download("xlsx", "edpop.xlsx", {sheetName: "EDPOP"});
},

downloadCSV: function() {
this.table.download("csv", "edpop.csv");
},
});
Loading