Use enumeration for dropdown box

I myself am surprised to have to ask this question but I’m unable to create a dropdown selector for a status field that is based on an enumeration. I thought it to be very simple but didn’t find a simple solution nor an example of it.

The enumeration is declared as such:

import com.haulmont.chile.core.datatypes.impl.EnumClass;

import javax.annotation.Nullable;

public enum TestStatus implements EnumClass<Integer> {


private Integer id;

TestStatus(Integer value) { = value;

public Integer getId() {
    return id;

public static TestStatus fromId(Integer id) {
    for (TestStatus at : TestStatus .values()) {
        if (at.getId().equals(id)) {
            return at;
    return null;

Within the screen there is a field group that includes the status field that is declared as an attribute of this enumeration:

                <fieldGroup id="fieldGroup"
                    <column width="250px">
                        <field id="testTitle"/>
                        <field id="testContent"
                        <field id="testStatus"/>

There are some option source attributes but I’m not getting the enumeration in as a source. I’m lost how to create a dropdown filled with the enumeration here.

Any help appreciated!

Hi Berend,

in you’ll find an example of this. the QuantityUnit is an enum that is used within the LineItem of an Order (see:✓&q=QuantityUnit+&type=Code).

A PickerField gets used automatically in this scenario in a fieldGroup.

Another example is used in the sampler application: (although it is not used within a fieldGroup)


Hi Mario,

Thanks for your answer and based on what I saw in the cuba-ordermanagement example I started a pure test application using only two enum fields in a single entity. When creating all fields, views and screens it worked without a problem.

However, when I then created another screen in which the table of items is combined with the edit/create fields for a single item (option ‘create single screen’), it didn’t work the way I expected. This was the scenario from my orginal post - although I didn’t mention it because I didn’t expect it to be relevant.

It seems that using this option the UI does not show the dropdown for the enum fields. Am I doing something wrong here or is this something of an issue? Attached is the test project as a zip.
Edit: attaching a file doesn’t work - don’t know why

Thanks for your quick answer and hope you can look into this once more.

Regards, Berend

You forgot the attachement :slight_smile:

Doesn’t really matter, i created a simple example with a single screen - see attached.

Mario (28.2K)

Thanks again. I tried your example, saw nothing special and when I initially started the edit screen didn’t seem to work either. However, I accidentally double clicked the data row in the table and then the dropdown appeared!

So, shame on me - I thought it was immediately in edit mode but this isn’t the case. You either need to click the edit button or double click the row. Knowing this, I returned to my own application and saw that it worked there as well, all the time so…

So it wasn’t an issue, just my mistake in understanding the UI behaviour. Sorry for using your time on this but it is much appreciated!