1

Using ENUM in Combox MVVM

asked 2014-01-17 10:57:30 +0800

sknitelius gravatar image sknitelius
10 1

I am trying to use ENUM in a Combobox as follows:

<combobox value="@bind(contract.company)"
    model="@bind(contract.company)" autodrop="true">
    <template name="model">
       <comboitem label="@bind(each.name)" value="@bind(each)" />
    </template>
</combobox>

ViewModel:

public Company getCompany() {
return company;
}

public void setCompany(final Company company) {
    this.company = company;
}

public Company[] getCompany() {
return Company.values();
}

Now I keep getting the following Exceptions:

Caused by: java.lang.IllegalArgumentException: No enum constant m.project.model.enums.Company.AcmeConsulting

The actual ENUM value is Company.ACME_CONSULTING, I am not sure if it is possible to use the ListBox with ENUM.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-01-18 06:39:26 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

See this fiddleExample will help you

link publish delete flag offensive edit

Comments

1

Simple, nice and neat.

chillworld ( 2014-01-18 07:22:41 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-01-17 10:57:30 +0800

Seen: 52 times

Last updated: Jan 18 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More