2
0
mirror of https://github.com/frappe/books.git synced 2024-09-20 11:29:00 +00:00

add getRows method in reportpage

This commit is contained in:
Faris Ansari 2018-04-19 15:44:24 +05:30
parent a85490eeae
commit a19833f325

View File

@ -10,7 +10,7 @@ const Observable = require('frappejs/utils/observable');
// `getColumns` return columns
module.exports = class ReportPage extends Page {
constructor({title, filterFields}) {
constructor({title, filterFields = []}) {
super({title: title, hasRoute: true});
this.fullPage = true;
@ -30,6 +30,10 @@ module.exports = class ReportPage extends Page {
// overrride
}
getRowsForDataTable(data) {
return data;
}
makeFilters() {
this.form = new Form({
parent: this.filterWrapper,
@ -79,14 +83,16 @@ module.exports = class ReportPage extends Page {
method: this.method,
args: filterValues
});
this.datatable.refresh(data);
const rows = this.getRowsForDataTable(data);
this.datatable.refresh(rows);
}
makeDataTable() {
this.datatable = new DataTable(this.tableWrapper, {
this.datatable = new DataTable(this.tableWrapper, Object.assign({
columns: utils.convertFieldsToDatatableColumns(this.getColumns(), this.layout),
data: [],
layout: this.layout || 'fluid',
});
}, this.datatableOptions || {}));
}
}