I used the following 4 lines of code setting up a NativeSelect in a vaadin java web application successfully and the NativeSelect menu was created and populated by my enum (ApplicationStatus).
When I tried to do the same thing in a declarative file, the NativeSelect menu shows up and is empty.
class Application extends VerticalLayout
{
public Application()
{
..
//ApplicationStatus is an enum, these exact four lines of code work fine without declarative
private NativeSelect<ApplicationStatus> categorySelect = new NativeSelect<ApplicationStatus>("Application Status");
categorySelect.setItems( ApplicationStatus.values());
categorySelect.setItemCaptionGenerator( ApplicationStatus::getName );
categorySelect.setSelectedItem(ApplicationStatus.ACTIVE);
..
}
Here is the Declarative HTML FILE (ATTEMPT1) //the menu shows up empty
...
<row>
<column><vaadin-label><strong>Decline Reason</strong></vaadin-label></column>
<column><v-native-select _id="categorySelect"></v-native-select></column>
</row>
...
**Here is the Declarative HTML FILE (ATTEMPT2)** //I tried populating it inline but the result was that the menu now has the word "Duplicate" showing 5 times.
...
<row>
<column><vaadin-label><strong>Change Category</strong></vaadin-label></column>
<column><vaadin-native-select _id="categorySelect">
<option value="D">Decline</option>
<option value="W">Waitlist</option>
<option value="R">Rejected by VCS</option>
<option value="P">Prospect</option>
<option value="C">Duplicate</option>
</vaadin-native-select></column>
</row>
...