fix(ReportView): Remember column widths

This commit is contained in:
Faris Ansari 2019-04-24 12:38:13 +05:30
parent d87b900f7e
commit 25316da863
3 changed files with 18 additions and 5 deletions

View file

@ -819,7 +819,20 @@ frappe.views.ReportView = class ReportView extends frappe.views.ListView {
setup_columns() {
const hide_columns = ['docstatus'];
const fields = this.fields.filter(f => !hide_columns.includes(f[0]));
// apply previous column width
let column_widths = null;
if (this.columns) {
column_widths = this.get_column_widths();
}
this.columns = fields.map(f => this.build_column(f)).filter(Boolean);
if (column_widths) {
this.columns = this.columns.map(column => {
column.width = column_widths[column.id] || column.width;
return column;
});
}
}
build_column(c) {

View file

@ -24,7 +24,7 @@
"cookie": "^0.3.1",
"express": "^4.16.2",
"fast-deep-equal": "^2.0.1",
"frappe-datatable": "^1.12.1",
"frappe-datatable": "^1.12.2",
"frappe-gantt": "^0.1.0",
"fuse.js": "^3.2.0",
"highlight.js": "^9.12.0",

View file

@ -1727,10 +1727,10 @@ fragment-cache@^0.2.1:
dependencies:
map-cache "^0.2.2"
frappe-datatable@^1.12.1:
version "1.12.1"
resolved "https://registry.yarnpkg.com/frappe-datatable/-/frappe-datatable-1.12.1.tgz#6efe342346025ffeed822e188a05da6c9c9230c9"
integrity sha512-AC2sJDuJOr0nSfT+w7DPZd7zPW7PHGhg9XxdRNlaAYpy45r3owdJVF+R6lCMQRvFvvzmPMht02EOE6cFpkzLKw==
frappe-datatable@^1.12.2:
version "1.12.2"
resolved "https://registry.yarnpkg.com/frappe-datatable/-/frappe-datatable-1.12.2.tgz#cb7e32defd38426c63278249843baa91dcba79aa"
integrity sha512-e4prKv4klBW9I5iVIesoeJgt4LofzZDfDxP+eqvQN2GZRVs8KYEXgyPhcaH89FfuhIkzVK6kDbMHw+KbGfOJIA==
dependencies:
hyperlist "^1.0.0-beta"
lodash "^4.17.5"