diff --git a/frappe/public/js/frappe/list/list_view.js b/frappe/public/js/frappe/list/list_view.js
index 21a5d95b25..eb4be0360b 100644
--- a/frappe/public/js/frappe/list/list_view.js
+++ b/frappe/public/js/frappe/list/list_view.js
@@ -334,9 +334,9 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
}
render_count() {
- this.get_count_html()
- .then(html => {
- this.$result.find('.list-count').html(html);
+ this.get_count_str()
+ .then(str => {
+ this.$result.find('.list-count').html(`${str}`);
});
}
@@ -570,7 +570,7 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
return html;
}
- get_count_html() {
+ get_count_str() {
const current_count = this.data.length;
return frappe.call({
@@ -582,10 +582,9 @@ frappe.views.ListView = class ListView extends frappe.views.BaseList {
fields: [`count(${frappe.model.get_full_column_name('name', this.doctype)}) as total_count`]
}
}).then(r => {
- const count = r.message.values[0][0] || current_count;
- const str = __('{0} of {1}', [current_count, count]);
- const html = `${str}`;
- return html;
+ this.total_count = r.message.values[0][0] || current_count;
+ const str = __('{0} of {1}', [current_count, this.total_count]);
+ return str;
});
}
diff --git a/frappe/public/js/frappe/views/reports/report_view.js b/frappe/public/js/frappe/views/reports/report_view.js
index 2b0214bd2d..468b0c5561 100644
--- a/frappe/public/js/frappe/views/reports/report_view.js
+++ b/frappe/public/js/frappe/views/reports/report_view.js
@@ -80,6 +80,7 @@ frappe.views.ReportView = class ReportView extends frappe.views.ListView {
render(force) {
if (this.data.length === 0) return;
+ this.render_count();
if (this.chart) {
this.refresh_charts();
@@ -91,6 +92,20 @@ frappe.views.ReportView = class ReportView extends frappe.views.ListView {
this.setup_datatable(this.data);
}
+ render_count() {
+ let $list_count = this.$paging_area.find('.list-count');
+ if (!$list_count.length) {
+ this.$paging_area.find('.btn-more').addClass('margin-left');
+ $list_count = $('')
+ .addClass('text-muted text-medium list-count')
+ .prependTo(this.$paging_area.find('.level-right'));
+ }
+ this.get_count_str()
+ .then(str => {
+ $list_count.text(str);
+ });
+ }
+
on_update(data) {
if (this.doctype === data.doctype && data.name) {
// flash row when doc is updated by some other user
@@ -998,33 +1013,50 @@ frappe.views.ReportView = class ReportView extends frappe.views.ListView {
const args = this.get_args();
const selected_items = this.get_checked_items(true);
- frappe.prompt({
- fieldtype:"Select", label: __("Select File Type"), fieldname:"file_format_type",
- options:"Excel\nCSV", default:"Excel", reqd: 1
- },
- (data) => {
- args.cmd = 'frappe.desk.reportview.export_query';
- args.file_format_type = data.file_format_type;
+ const d = new frappe.ui.Dialog({
+ title: __("Export Report: {0}",[__(this.doctype)]),
+ fields: [
+ {
+ fieldtype: 'Select',
+ label: __('Select File Type'),
+ fieldname:'file_format_type',
+ options: ['Excel', 'CSV'],
+ default: 'Excel'
+ },
+ {
+ fieldtype: 'Check',
+ fieldname: 'export_all_rows',
+ label: __('Export All {0} rows?', [(this.total_count + "").bold()])
+ }
+ ],
+ primary_action_label: __('Download'),
+ primary_action: (data) => {
+ args.cmd = 'frappe.desk.reportview.export_query';
+ args.file_format_type = data.file_format_type;
- if (args.file_format_type === 'CSV') {
- frappe.tools.downloadify(this.data, null, this.doctype);
- return;
- }
+ if(this.add_totals_row) {
+ args.add_totals_row = 1;
+ }
- if(this.add_totals_row) {
- args.add_totals_row = 1;
- }
+ if(selected_items.length > 0) {
+ args.selected_items = selected_items;
+ }
- if(selected_items.length > 0) {
- args.selected_items = selected_items;
- }
+ if (!data.export_all_rows) {
+ args.start = 0;
+ args.page_length = this.data.length;
+ } else {
+ delete args.start;
+ delete args.page_length;
+ }
- args.start = 0;
- args.page_length = this.data.length;
+ open_url_post(frappe.request.url, args);
- open_url_post(frappe.request.url, args);
- },
- __("Export Report: {0}",[__(this.doctype)]), __("Download"));
+ d.hide();
+ },
+ });
+
+ d.show();
}
});
}