开发者

Richfaces suggestionbox

I'm trying to use a List of SelectItems with RichFaces suggestionBox c开发者_Go百科omponent. The problem is I need to store the id rather than the label of the SelectItem. It seems that the suggestionBox always stores the label and that's causing a problem. Is there a way out of this problem?


I use something like this:

<h:inputText
    id="suggest"
    value="#{someBean.someStringValue}"
    converter="#{myStringValueConverter}">
    <a:support event="onblur" ajaxSingle="true"/>
</h:inputText>

<rich:suggestionbox for="suggest"
    suggestionAction="#{suggestionInstance.suggestion}"
    var="s"
    fetchValue="#{s.someValue}"
    ajaxSingle="true">
    <h:column>
        <h:outputText value="#{s.anotherValue}"/>
    </h:column>
    <h:column>
        <h:outputText value="#{s.yetAnotherValue}"/>
    </h:column>
    <a:support event="onselect" ajaxSingle="true" reRender="target">
        <f:setPropertyActionListener value="#{s}" target="#{someBean.someObject}" />
    </a:support>
</rich:suggestionbox>

The setPropertyActionListener does the job that you are looking for. I also have a converter on my input text so the user can just type in something (UN Location codes in my instance) and I can try to parse this in the converter to an Object.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜