开发者

Adding a clickable button or text to rich:suggestionbox suggestions [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 10 years ago.

I'd like to add a button to the suggestions presented in a rich:suggestionbox (an 'x' so suggestions can be removed). Is there a way to keep from being selected?

What I've tried so far:

<rich:suggestionbox id="suggestionBox" for="inputText"
                            suggestionAction="#{myBean.getSugestions}"
                            var="result" fetchValue="#{result}" usingSuggestObjects="true">
                            <h:column>
                                <h:outputText value="#{result}" />
                            </h:column>
                            <h:column>
                                <a4j:outputPanel
                                    onclick="removeCommand('#{result}');Event.stop(event);">
                                    <h:outputText value="X" />
                                </a4j:outputPanel>
                            </h:column>

                        </rich:suggestionbox>
<a4j:jsFunction name="removeCommand"
    action="#{myBean.removeSuggestion}" ajaxSingle="true"
    re开发者_运维知识库Render="commandInputBox">
    <a4j:actionparam name="removedCommand" />
</a4j:jsFunction>

The Event.stop(event) was inspired by a similar technique used by Ilya Shaikovsky

I'm open to suggestions (hehe) that use completely other techniques too.


The technique works just fine! I had a typo that was causing a client side error that halted the onclick processing. See the edit for details.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜