Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Guglielmo2021-06-15 09:57:14 +0000
committerClaudio Guglielmo2021-06-15 16:23:37 +0000
commit72002c79c40f59872ab5f09e4a9fd184ddd629b5 (patch)
tree836609373413453670ce3a223d5fa1afa617f85b
parent99d403f05b90f6528db219e4d94690bf782aa201 (diff)
downloadorg.eclipse.scout.rt-72002c79c40f59872ab5f09e4a9fd184ddd629b5.tar.gz
org.eclipse.scout.rt-72002c79c40f59872ab5f09e4a9fd184ddd629b5.tar.xz
org.eclipse.scout.rt-72002c79c40f59872ab5f09e4a9fd184ddd629b5.zip
Widget: invalidate layout on css class changes
Toggling a css class could change the size of a widget and could therefore require a layout invalidation. From java code, it is not possible to invalidate the layout, so it would be necessary to create a custom widget and do it with JS. Or we could add the possibility to invalidate the layout to Widget.java. But actually calling invalidate layout from outside of a widget should never be necessary, so we decided to do it on every cssClass change. If it turns out that it has too many side effects (flickering, performance) on widgets that don't require the invalidation, we will think of another solution. 292520
-rw-r--r--eclipse-scout-core/src/widget/Widget.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/eclipse-scout-core/src/widget/Widget.js b/eclipse-scout-core/src/widget/Widget.js
index 109442c7fe..02dab6974f 100644
--- a/eclipse-scout-core/src/widget/Widget.js
+++ b/eclipse-scout-core/src/widget/Widget.js
@@ -938,6 +938,10 @@ export default class Widget {
return;
}
this.$container.addClass(this.cssClass);
+ if (this.htmlComp) {
+ // Replacing css classes may enlarge or shrink the widget (e.g. setting the font weight to bold makes the text bigger) -> invalidate layout
+ this.invalidateLayoutTree();
+ }
}
setCssClass(cssClass) {

Back to the top