添加到残疾人div的组件并非全部继承残疾人属性
对于我们的UI的一部分,主要DIV被禁用,然后根据加载的数据添加更多组件。但是,如果在添加其他组件之前禁用主DIV,则仅添加的一些其他组件具有禁用的属性集。
已经尝试使用Java 17的Vaadin 23.0.10和
。
VerticalLayout vlMain = new VerticalLayout();
vlMain.setSizeFull();
HorizontalLayout hlOne = new HorizontalLayout(FontAwesome.Solid.BUG.create(), new Button("Testing"));
HorizontalLayout hlTwo = new HorizontalLayout();
hlOne.setEnabled(false);
hlTwo.setEnabled(false);
Button add = new Button("Add");
add.addClickListener(buttonClickEvent -> {
if(buttonClickEvent.isFromClient())
{
hlTwo.add(FontAwesome.Solid.BUG.create());
hlTwo.add(new Button("Testing"));
}
});
vlMain.add(hlOne, hlTwo, add);
23.1.0rc1 单击按钮添加其他组件,但是图标不会继承残疾人属性,但该按钮可以。再次调用hltwo.setEnabled(false),然后正确设置所有内容。可以使用浏览器检查器对此进行验证。
尽管有解决方法,但很高兴知道预期的行为应该是什么。
谢谢。
For part of our UI, the main div is disabled and then more components are added based on the data loaded. However, if the main div is disabled before adding the additional components, then only some of the additional components added have the disabled attribute set.
Have tried Vaadin 23.0.10 and 23.1.0rc1 with Java 17.
Example code:
VerticalLayout vlMain = new VerticalLayout();
vlMain.setSizeFull();
HorizontalLayout hlOne = new HorizontalLayout(FontAwesome.Solid.BUG.create(), new Button("Testing"));
HorizontalLayout hlTwo = new HorizontalLayout();
hlOne.setEnabled(false);
hlTwo.setEnabled(false);
Button add = new Button("Add");
add.addClickListener(buttonClickEvent -> {
if(buttonClickEvent.isFromClient())
{
hlTwo.add(FontAwesome.Solid.BUG.create());
hlTwo.add(new Button("Testing"));
}
});
vlMain.add(hlOne, hlTwo, add);
When the above is run, hlOne contains 2 disabled controls.
Clicking the button adds the additional components, however the icon doesn't inherit the disabled attribute but the button does. Calling hlTwo.setEnabled(false) again then sets everything correctly. This can be verified using the browser inspector.
While there is the workaround, it would be good to know what the expected behaviour should be.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论