Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSF ajax event delay

Tags:

jsf

jsf-2

I want to implement a live filter for a list with JSF 2 but when using keyup event so many requests are being sent to the server. The code looks like:

<h:inputText id="filter_input" value="#{bean.filterText}">
    <f:ajax event="keyup" listener="#{bean.filter}" 
        render="@form:list" execute="@this" />
</h:inputText>
like image 534
Xtreme Biker Avatar asked Dec 25 '22 15:12

Xtreme Biker


1 Answers

f:ajax has added support for ajax event delay starting from JSF 2.2. Just include it as an attribute with its value in miliseconds:

<f:ajax event="keyup" delay="1000" listener="#{someBean.doSomething}"
    render="somefield" execute="@this" />

See also:

  • Primefaces keyup event delay
  • Richfaces a4j event queuing
  • Delay a JSF AJAX listener for checkbox group
  • JSF 2.1 Ajax autocomplete + server search only after user stops typing
like image 182
Xtreme Biker Avatar answered Dec 28 '22 06:12

Xtreme Biker