2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 15:50:56 +00:00

[fix] Use frappe.call to get report data on ReportPage

This commit is contained in:
Faris Ansari 2018-09-06 14:04:45 +05:30
parent 4c0e85aaec
commit 06c06a81cb

View File

@ -25,17 +25,39 @@ export default {
} }
}, },
methods: { methods: {
getReportData(filters) { async getReportData(filters) {
frappe.methods[this.reportConfig.method](filters).then(data => { let data = await frappe.call({
method: this.reportConfig.method,
args: filters
});
let rows, columns;
if (data.rows) {
rows = data.rows;
} else {
rows = data;
}
if (data.columns) {
columns = data.columns;
}
if (!rows) {
rows = [];
}
if (!columns) {
columns = this.reportColumns;
}
if (this.datatable) { if (this.datatable) {
this.datatable.refresh(data || []); this.datatable.refresh(rows, columns);
} else { } else {
this.datatable = new DataTable(this.$refs.datatable, { this.datatable = new DataTable(this.$refs.datatable, {
columns: this.reportColumns, columns: columns,
data: data || [] data: rows
}); });
} }
});
} }
}, },
components: { components: {