listBox
listBox
allows users to select a single value from a scrollable list of items.
-
XML element:
listBox
-
Java class:
JmixListBox
Basics
listbox
can be populated with items from either an enumeration or collection of entities.
Use the itemsEnum attribute to directly specify the name of the enumeration class:
<listBox itemsEnum="com.company.onboarding.entity.OnboardingStatus"/>
In case of entities, first define a collection container and then pass its name to the itemsContainer attribute:
<data>
<collection class="com.company.onboarding.entity.City" id="citiesDc"> (1)
<fetchPlan extends="_base"/>
<loader id="citiesDl">
<query>
<![CDATA[select e from City e]]>
</query>
</loader>
</collection>
</data>
<layout>
<listBox itemsContainer="citiesDc"/> (2)
</layout>
1 | CollectionContainer for the City entity. |
2 | citiesDc is set as an items container for the component. |
Handlers
Чтобы сгенерировать заглушку обработчика в Jmix Studio, используйте вкладку Handlers панели инспектора Jmix UI, или команду Generate Handler, доступную на верхней панели контроллера экрана и через меню Code → Generate (Alt+Insert / Cmd+N). |
See Also
See the Vaadin Docs for more information.