[英]JSF selectOneMenu not whole List
Is it possible to choose only specific items from the list in selectOneMenu? 是否可以从selectOneMenu的列表中仅选择特定项目? For example.
例如。 I have List Products has many fields like name, id etc. One of it is category (1,2 or 3) I want to have only one category in the selectOneMenu without making new Lists and new classes.
我有List Products,其中有许多字段,如名称,id等。其中一个是类别(1、2或3),我希望在selectOneMenu中仅具有一个类别,而无需创建新的列表和新类。 Can you help me?
你能帮助我吗?
I think the easiest way is to set the value
attribute of f:selectItems
to a method which filters your original collection. 我认为最简单的方法是将
f:selectItems
的value
属性设置为一种过滤原始集合的方法。
Otherwise you'd have to implement your own version of f:selectItems
which allows filtering - as we once did in one of our projects. 否则,您将必须实现自己的
f:selectItems
版本,该版本可以进行过滤-正如我们曾经在一个项目中所做的那样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.