Hi,
I need to implement in Jmix Flow UI a widget similar to vaadin ComboBox with allowcustomvalue, so I can choose value from a list or typing in it.
I am not able to do, I have tried with entityPicker and entityComboBox but without luck.
Can you help me?
Thanks,
Mario
Hi, Mario!
I guess entityComboBox is right for you.
Probably, you need to set itemsContainer attribute.
<view xmlns="http://jmix.io/schema/flowui/view"
title="msg://newEntityDetailView.title"
focusComponent="form">
<data>
<instance id="newEntityDc"
class="com.company.codeeditor.entity.NewEntity">
<fetchPlan extends="_base">
<property name="test" fetchPlan="_base"/>
</fetchPlan>
<loader/>
</instance>
<collection id="testEntitiesDc"
class="com.company.codeeditor.entity.TestEntity">
<fetchPlan extends="_base"/>
<loader id="testEntitiesDl">
<query>
<![CDATA[select e from TestEntity e]]>
</query>
</loader>
</collection>
</data>
<facets>
<dataLoadCoordinator auto="true"/>
</facets>
<actions>
<action id="saveAction" type="detail_saveClose"/>
<action id="closeAction" type="detail_close"/>
</actions>
<layout>
<formLayout id="form" dataContainer="newEntityDc">
<textField id="nameField" property="name"/>
<entityComboBox id="testField" property="test" itemsContainer="testEntitiesDc"/>
</formLayout>
<hbox id="detailActions">
<button id="saveAndCloseBtn" action="saveAction"/>
<button id="closeBtn" action="closeAction"/>
</hbox>
</layout>
</view>
Example:

If you need to handle custom values with ComboBox, you can use the following code snippets:
<!-- Descriptior-->
<comboBox id="comboBox" allowCustomValue="true"/>
// Controller
@Subscribe("comboBox")
public void onComboBoxCustomValueSet(ComboBoxBase.CustomValueSetEvent<? extends JmixComboBox<?>> event) {
//do logic
}
Regards,
Dmitriy
Thanks for reply it works but I cannot put any action in combobox otherwise it does not work anymore.
If you want to use actions with component then use comboBoxPicker.
In FlowUI, components that support actions are called ...Picker.