-
15. Re: how to migrate setPropertyActionListener in rich:autocomplete
rizwanali89 Aug 12, 2012 3:16 AM (in response to charriu)Hi Felix.
Nice work after i implement your solution i found that it just work fine with mouse events. But when i select an item and then hit enter key nothing happen. I have also try to use the javascript method related to onlist keypress and others method too. But its not working. Again its work just fine if i am just use moue to button to select an item.
-
16. Re: how to migrate setPropertyActionListener in rich:autocomplete
pat0675 Mar 6, 2013 2:28 AM (in response to rizwanali89)Hi,
I ve got the same Problem at the moment now. Does anybody meanwhile found a more suitable solution for this?
-
17. Re: how to migrate setPropertyActionListener in rich:autocomplete
neophd May 28, 2013 3:58 PM (in response to pat0675)1 of 1 people found this helpfulHi,
This is my solution:
<rich:autocomplete mode="ajax" var="item" fetchValue="#{item.nomeCidade}"
autocompleteMethod="#{contatoPessoaJuridicaMBean.buscarCidadesPorNome}"
value="#{contatoPessoaJuridicaMBean.novoEndereco.cidade.nomeCidade}"
onkeydown="if(event.keyCode == 13)setIdCidade($('.rf-au-itm-sel span').attr('title'))">
<h:outputText value="#{item.nomeCidade} / #{item.uf.siglaUf}" title="#{item.id}"/>
<a4j:jsFunction name="setIdCidade">
<a4j:param name="param" assignTo="#{contatoPessoaJuridicaMBean.idCidadeSelecionada}" />
</a4j:jsFunction>
<f:ajax event="selectitem" render="uf" onevent="setIdCidade(event.target.title)" />
</rich:autocomplete>
<h:outputText id="uf" value="#{contatoPessoaFisicaMBean.novoEndereco.cidade.uf.siglaUf}"
style="width: 40px; text-transform: uppercase;"/>
Its work for IE, Chrome, Firefox using mouse click or enter key for selection.
I hope this solution help you!
-
18. Re: how to migrate setPropertyActionListener in rich:autocomplete
caracupa Jun 18, 2018 3:23 AM (in response to neophd)Your solution don't work completely. Using mouse click or enter key for selection does not work together.
The main idea of my example is that two similar events need to be processed separately by different java-script functions:
<script type="text/javascript">
var PageActions = {
processSelectEvent: function(target) {
SetIdOfLinkEmployee(target);
}
};
</script>
<a4j:jsFunction name="SetIdOfLinkEmployee" action="#{editTourniquetUserBean.changeLinkEmployee}" render="@form" oncomplete="ViewManager.fitWindowToContent();">
<a4j:param name="param" assignTo="#{editTourniquetUserBean.linkEmployeeId}"/>
</a4j:jsFunction>
<rich:autocomplete id="linkEmployeePopupField" styleClass="input-common ac-mini-input-common" style="width: 373px" popupClass="form-ac-mini-popup"
autocompleteMethod="#{editTourniquetUserBean.searchEmployeesByLastName}"
autocompleteList="#{editTourniquetUserBean.linkEmployeesSearchList.filtered}"
var="linkEmployee"
fetchValue="#{linkEmployee.lastName}"
value="#{editTourniquetUserBean.linkEmployeeName}"
mode="ajax"
onkeydown="if(event.keyCode == 13) SetId($('.rf-au-itm-sel span').attr('title'))"
onselectitem="PageActions.processSelectEvent(event.target.title)"
minChars="2" autofill="true" selectFirst="false" layout="div"><h:outputText value="#{linkEmployee.lastName} [#{linkEmployee.fullFio}]" title="#{linkEmployee.employeeId}"/>
<a4j:jsFunction name="SetId">
<a4j:param name="param" assignTo="#{editTourniquetUserBean.linkEmployeeId}"/>
</a4j:jsFunction>
</rich:autocomplete>
-
19. Re: how to migrate setPropertyActionListener in rich:autocomplete
michpetrov Jun 18, 2018 4:42 AM (in response to caracupa)caracupa first of all you're replying to a 5-year old post. Secondly you're introducing a new function and not showing what it does, why does `SetIdOfLinkEmployee` call an action when `SetId` doesn't have to?
-
20. Re: how to migrate setPropertyActionListener in rich:autocomplete
caracupa Jun 18, 2018 5:27 AM (in response to michpetrov)Why can not someone touch the necro-post?
First the keydown event handle-function set up the employee id and
then the selectitem event handle-function call action.
-
21. Re: how to migrate setPropertyActionListener in rich:autocomplete
michpetrov Jun 18, 2018 12:56 PM (in response to caracupa)Why can not someone touch the necro-post?
It think it's fair to assume the people involved no longer care and maybe not even use RichFaces anymore.
First the keydown event handle-function set up the employee id and
then the selectitem event handle-function call action.
Both the selectItem and keyDown are setting the id, but only selectItem calls some kind of action for which you've provided no code. (As opposed to the solution you're saying is not good enough where no action is called.)
-
22. Re: how to migrate setPropertyActionListener in rich:autocomplete
caracupa Jun 18, 2018 11:46 PM (in response to michpetrov)michpetrov написал(-а):
Why can not someone touch the necro-post?
It think it's fair to assume the people involved no longer care and maybe not even use RichFaces anymore.
First the keydown event handle-function set up the employee id and
then the selectitem event handle-function call action.
Both the selectItem and keyDown are setting the id, but only selectItem calls some kind of action for which you've provided no code. (As opposed to the solution you're saying is not good enough where no action is called.)
Code without action is useless. If you try to call action as it was before
it will not work well
-
23. Re: how to migrate setPropertyActionListener in rich:autocomplete
michpetrov Jun 19, 2018 12:01 PM (in response to caracupa)Code without action is useless. If you try to call action as it was before
it will not work well
I'm asking you to tell me what the action does, then I would see that it is necessary.
-
24. Re: how to migrate setPropertyActionListener in rich:autocomplete
larsonreever Apr 5, 2019 7:05 AM (in response to feuyeux)This doesn't work for me. I tried an a4j:ajax with event="selectitem", event="onchange" and "event="valuechange", switch to f:ajax, add a valueChangeListener too, but nothing worked. Take a look at primefaces, there ist is trivial with the attributes itemLabel and itemValue.
The event.target.previousSibling is "undefined", target ist an div, but i don't get which one. Here is my code:
<rich:autocomplete id="via"minChars="1" autofill="false" value="#{stop.name}" var="station" fetchValue="#{station.name} - #{station.id}"
autocompleteMethod="#{sessionBean.autoCompleteStation}">
<h:outputText value="#{station.name}#{stop.name} (#{station.id})" />
</rich:autocomplete>
Thanks
Sr, Developer | Dimehub
-
25. Re: how to migrate setPropertyActionListener in rich:autocomplete
michpetrov Apr 5, 2019 10:43 AM (in response to larsonreever)larsonreever you're replying to an 8 year old post, what are you trying to do? What is the functionality that you're trying to implement?