如何在 Vaadin 中从组合框中预选择项目?

问题描述 投票:0回答:1

ComboBox 类中没有 select 方法。还有其他方法可以在 Vaadin 组合框中预选项目吗?这是我的代码:

final ComboBox<ReportTypeEnum> selectionBox = new ComboBox<>("Rapporttyp");
selectionBox.setWidthFull();
selectionBox.setItems(getPatentNationalReportTypeList());
selectionBox.addValueChangeListener(e -> setVisibilityOfGenerateReportTypeButton());
vaadin vaadin-flow vaadin23
1个回答
0
投票

ComboBox
实现
HasValue
时,你必须调用
setValue()

HasValue
由代表值的所有组件使用:

https://vaadin.com/api/platform/current/com/vaadin/flow/component/HasValue.html

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.