Sunday, August 31, 2014

Re: Use FilterTextBox after a specific time


W dniu czwartek, 28 sierpnia 2014 13:39:55 UTC+2 użytkownik Dominic Warzok napisał:
Hi, 

in my webapp we have a very lagre collection. The user has the ability to filter these collection.
But if you tipe in one letter and start filtering it needs a lot of time. 
So I try to change the valueChangeHandler to only update the value in the box after 2 seconds when typing ended. 



AFAIR typing in TextBox doesn't triger ValueChangeEvent. Here is my solution:


    private Timer timer = null;
   
@UiHandler("filter")
   
public void onFilterKeyUp(KeyUpEvent event)
   
{
       
if (timer != null)
            timer
.cancel();
       
        timer
= new Timer()
       
{
           
public void run()
           
{
                getUiHandlers
().filter(filter.getText());
           
}
       
};
       
timer.schedule(500);

       
   
}




--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment