How to display an Enum as a <select> in Advanced Search filters?

42 views
Skip to first unread message

Marco Cirillo

unread,
Jul 2, 2016, 12:05:13 PM7/2/16
to Light Admin Group
I have an enum on an entity, Review.Type, that I would like to have show up as a <select> in the Advanced Search section, but I'm unsure how to accomplish this:

@Override
public FiltersConfigurationUnit filters(final FiltersConfigurationUnitBuilder filterBuilder ) {
   
return filterBuilder
           
.filter("Business", "business")
           
.filter("User", "user")
           
.filter("Type", "type")
           
// This doesn't work, but I want `type` to have a <select> with 'good' and 'bad' as options
           
.renderer(enumeration(
                   
EnumElement.element(Review.Type.GOOD.toString(), "Good"),
                   
EnumElement.element(Review.Type.BAD.toString(), "Bad")
           
))
           
.filter("Is Premium?", "isPremium")
           
.filter("Is Confirmed?", "isConfirmed")
           
.build();
}


Reply all
Reply to author
Forward
0 new messages