是否有可能在Wicket的下拉菜单中添加彩色物品?下拉列表将从枚举类中获取其值。 例如,enum类具有“红色,黄色,绿色”元素。根据元素,下拉部分将是绿色,红色,黄色。 我该怎么做? 是否可以在DropDownChoice上使用AttributeModifier?
答案 0 :(得分:3)
选择组件比DropDownChoice更灵活,但由于每个<选项>使用SelectOption组件,它也会消耗更多内存。
答案 1 :(得分:2)
试试这个......
<style type="text/css">
OPTION.red{color:red}
OPTION.yellow{color:yellow}
OPTION.green{color:green}
</style>
<select id="myselect">
<option value="1" class="red">red</option>
<option value="2" class="yellow">yellow</option>
<option value="3" class="green">green</option>
</select>
答案 2 :(得分:0)
有几种方法,详细on the wiki,可以在呈现时动态添加或更改html标记上的属性。