-
1. Re: suggestionbox - feature request and question
sergeysmirnov Apr 12, 2007 2:28 PM (in response to greko)if you want to update the value printed by the h:outputText, you do it right way. In theory, you can change something on the client side using <a4j:support onsubmit="...">. However, if you replace the outcome h:outputText, it will be out-of-sync with the server side value of it.
suggestion box works like dataTable. So, you can highlight what ever you want there in the manner you can do it in the regular dataTable outcome. -
2. Re: suggestionbox - feature request and question
greko Apr 13, 2007 4:36 AM (in response to greko)Thanks for your reply,
But i don't think it really answers my question.
Here is my sample code :<h:inputText value="#{settings.currentPrincipal}" id="suggest" /> <!-- fetch #{suggest.value2} here --> <span id="val2"></span> <rich:suggestionbox for="suggest" suggestionAction="#{pageBean.autocomplete}" eventsQueue="myQueue" fetchValue="#{suggest.value1}" requestDelay="500" ignoreDupResponses="true" width="200" height="100" onselect="alert('#{suggest.value2}');" var="suggest"> <h:column> <h:outputText value="#{suggest.value1}"/> </h:column> <h:column> <h:outputText value="#{suggest.value2}"/> </h:column> </rich:suggestionbox>
I want to find a way to fetch #{suggest.value2} somewhere (a span for example), but i can't access my suggest var in javascript (onselect or oncomplete). It is not possible with <a4j:support> either... -
3. Re: suggestionbox - feature request and question
ilya_shaikovsky Apr 13, 2007 4:48 AM (in response to greko)yes you need to use support for onselect in your case I think.
-
4. Re: suggestionbox - feature request and question
greko Apr 13, 2007 4:55 AM (in response to greko)Unfortunatelly, <a4j:support> can't catch my suggest variable ...
I tried something like this :... <a4j:support event="onselect" actionListener="#{pageBean.select(suggest.value2)}" reRender="some_id" /> ...
But the parameter (suggest.value2) is empty... as if my suggest variable were unreacheable. -
5. Re: suggestionbox - feature request and question
ilya_shaikovsky Apr 13, 2007 6:09 AM (in response to greko)but after you add this support your input will be submited also. So you may get #{settings.currentPrincipal} on server and get some additional info after that.
-
6. Re: suggestionbox - feature request and question
greko Apr 13, 2007 6:38 AM (in response to greko)yes, it's true. But it costs me a db call to get extra info, whereas i already have this info through the autocomplete method ...
we found a solution, using only javascript, but its a bit tricky (fetch both values in the input field, then split and do what i want to do).
I though there could be an easier way to do this.
Thanks, BTW !