I want to use @helper.select
form Play 2 template engine where I should specify Seq[(String,String)]
containing data for <options>
. But I have List<Enum>
. And I know rather weakly Scala.
Without this helper I populate <select>
using this code:
@for( category <- Categories.values()){
<option value="@category">@Messages.get( category.getI18NName )</option>
}
And definition of Category:
public enum Category{
CATEGORY1{
@Override
public String getI18NName(){
return "category.category1";
}
},
CATEGORY2{
@Override
public String getI18NName(){
return "category.category2";
}
};
public String getI18NName(){
return null;
}
}
For test I used options = options("1" -> "1", "2" -> "2", "3" -> "3", "4" -> "4", "5" -> "5")
form Java example of inputRadioGroup in Play2
How can I get Seq[(String,String)]
from my List<Enum>
?
Thanks