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

setValue method in formLayout

This commit is contained in:
Faris Ansari 2018-04-26 15:50:20 +05:30
parent ddfd9a7e11
commit 30436ef256
3 changed files with 16 additions and 0 deletions

View File

@ -24,6 +24,7 @@ module.exports = class ReportPage extends Page {
});
this.makeFilters();
this.setDefaultFilterValues();
}
getColumns() {
@ -45,6 +46,10 @@ module.exports = class ReportPage extends Page {
this.filterWrapper.appendChild(this.filters.form);
}
setDefaultFilterValues() {
}
getFilterValues() {
const values = {};
for (let control of this.filters.controlList) {

View File

@ -317,6 +317,7 @@ module.exports = class BaseForm extends Observable {
this.refresh();
this.trigger('change');
} catch (e) {
console.error(e);
frappe.ui.showAlert({message: frappe._('Failed'), color: 'red'});
return;
}

View File

@ -80,9 +80,19 @@ module.exports = class FormLayout extends Observable {
this.controlList.forEach(control => {
control.bind(this.doc);
});
this.doc.on('change', ({doc, fieldname}) => {
this.controls[fieldname].refresh();
});
this.refresh();
}
setValue(key, value) {
if (!this.doc) return;
this.doc.set(key, value);
}
refresh() {
this.controlList.forEach(control => {
control.refresh();