primefaces keyup or other ajax event delay

后端 未结 4 1735
一个人的身影
一个人的身影 2020-12-03 04:59

I have something like:


    
         


        
4条回答
  •  臣服心动
    2020-12-03 05:59

    You cannot use the Primefaces Ajax Component, if you chose the jquery/javascript solution. You would have to implement your own javascript function (with ajax/xmlHttpRequest support) and trigger that function after half a second.

    But there is another solution, a workaround: you could use an autocomplete component and use 3 helpful attributes: valueChangeListener(A method expression that refers to a method for handling a valuchangeevent - you use that instead of completeMethod because you don't need the returning suggestions), queryDelay (Delay to wait in milliseconds before sending each query to the server) and minQueryLength (Number of characters to be typed before starting to query - if you don't want to start the ajax request after just one character typed).

    I hope you will find this solution quiet interesting...Please see the autocomplete component in action here( http://www.primefaces.org/showcase-labs/ui/autocompleteHome.jsf ) and you can find out more by reading the Primefaces User Guide for 3.0.M4.

提交回复
热议问题