fix: Query report print fix
This commit is contained in:
parent
f75aa3beff
commit
a25e66cc00
1 changed files with 12 additions and 2 deletions
|
|
@ -347,6 +347,7 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
|
|||
|
||||
this.render_datatable();
|
||||
} else {
|
||||
this.data = [];
|
||||
this.toggle_nothing_to_show(true);
|
||||
}
|
||||
|
||||
|
|
@ -922,12 +923,21 @@ frappe.views.QueryReport = class QueryReport extends frappe.views.BaseList {
|
|||
}
|
||||
|
||||
get_data_for_print() {
|
||||
const indices = this.datatable.datamanager.getFilteredRowIndices();
|
||||
let rows = indices.map(i => this.data[i]);
|
||||
if (!this.data.length) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const rows = this.datatable.datamanager.rowViewOrder.map(index => {
|
||||
if (this.datatable.bodyRenderer.visibleRowIndices.includes(index)) {
|
||||
return this.data[index];
|
||||
}
|
||||
}).filter(Boolean);
|
||||
|
||||
let totalRow = this.datatable.bodyRenderer.getTotalRow().reduce((row, cell) => {
|
||||
row[cell.column.id] = cell.content;
|
||||
return row;
|
||||
}, {});
|
||||
|
||||
rows.push(totalRow);
|
||||
return rows;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue