Adding a clickable button or text to rich:suggestionbox suggestions [closed]
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.
精彩评论