2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00

Make reportColumns a method

This commit is contained in:
Faris Ansari 2018-10-26 02:28:08 +05:30
parent 9fd9452d27
commit e8c2e5cca6

View File

@ -18,11 +18,6 @@ export default {
name: 'Report', name: 'Report',
props: ['reportName', 'reportConfig', 'filters'], props: ['reportName', 'reportConfig', 'filters'],
computed: { computed: {
reportColumns() {
return utils.convertFieldsToDatatableColumns(
this.reportConfig.getColumns()
);
},
filtersExists() { filtersExists() {
return (this.reportConfig.filterFields || []).length; return (this.reportConfig.filterFields || []).length;
} }
@ -42,7 +37,7 @@ export default {
} }
if (data.columns) { if (data.columns) {
columns = data.columns; columns = this.getColumns(data);
} }
if (!rows) { if (!rows) {
@ -50,7 +45,7 @@ export default {
} }
if (!columns) { if (!columns) {
columns = this.reportColumns; columns = this.getColumns();
} }
for(let column of columns) { for(let column of columns) {
@ -65,6 +60,10 @@ export default {
data: rows data: rows
}); });
} }
},
getColumns(data) {
const columns = this.reportConfig.getColumns(data);
return utils.convertFieldsToDatatableColumns(columns);
} }
}, },
components: { components: {