DEV: allows to call a widget function without re-rendering the widget (#10004)

This commit is contained in:
Joffrey JAFFEUX 2020-06-09 19:58:17 +02:00 committed by GitHub
parent 84d767716f
commit 43e17f92e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 5 deletions

View File

@ -327,14 +327,21 @@ export default class Widget {
});
}
callWidgetFunction(name, param) {
const widget = this._findAncestorWithProperty(name);
if (widget) {
return widget[name].call(widget, param);
}
}
sendWidgetAction(name, param) {
return this.rerenderResult(() => {
const widget = this._findAncestorWithProperty(name);
if (widget) {
return widget[name].call(widget, param);
}
const widgetFunction = this.callWidgetFunction(name, param);
return this._sendComponentAction(name, param || this.findAncestorModel());
return (
widgetFunction ||
this._sendComponentAction(name, param || this.findAncestorModel())
);
});
}