mirror of
https://github.com/frappe/books.git
synced 2024-11-10 07:40:55 +00:00
setValue method in formLayout
This commit is contained in:
parent
ddfd9a7e11
commit
30436ef256
@ -24,6 +24,7 @@ module.exports = class ReportPage extends Page {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.makeFilters();
|
this.makeFilters();
|
||||||
|
this.setDefaultFilterValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
getColumns() {
|
getColumns() {
|
||||||
@ -45,6 +46,10 @@ module.exports = class ReportPage extends Page {
|
|||||||
this.filterWrapper.appendChild(this.filters.form);
|
this.filterWrapper.appendChild(this.filters.form);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setDefaultFilterValues() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
getFilterValues() {
|
getFilterValues() {
|
||||||
const values = {};
|
const values = {};
|
||||||
for (let control of this.filters.controlList) {
|
for (let control of this.filters.controlList) {
|
||||||
|
@ -317,6 +317,7 @@ module.exports = class BaseForm extends Observable {
|
|||||||
this.refresh();
|
this.refresh();
|
||||||
this.trigger('change');
|
this.trigger('change');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
frappe.ui.showAlert({message: frappe._('Failed'), color: 'red'});
|
frappe.ui.showAlert({message: frappe._('Failed'), color: 'red'});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -80,9 +80,19 @@ module.exports = class FormLayout extends Observable {
|
|||||||
this.controlList.forEach(control => {
|
this.controlList.forEach(control => {
|
||||||
control.bind(this.doc);
|
control.bind(this.doc);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.doc.on('change', ({doc, fieldname}) => {
|
||||||
|
this.controls[fieldname].refresh();
|
||||||
|
});
|
||||||
|
|
||||||
this.refresh();
|
this.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setValue(key, value) {
|
||||||
|
if (!this.doc) return;
|
||||||
|
this.doc.set(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
this.controlList.forEach(control => {
|
this.controlList.forEach(control => {
|
||||||
control.refresh();
|
control.refresh();
|
||||||
|
Loading…
Reference in New Issue
Block a user