Thursday, August 28, 2014

Use FilterTextBox after a specific time

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. 

This is my code:

  @Override
  public void onValueChange( ValueChangeEvent<String> event )
  {
    Timer t = new Timer()
    {
      @Override
      public void run()
      {
        addChangeHandler( new ChangeHandler()
        {
          @Override
          public void onChange( ChangeEvent event1 )
          {
            ValueChangeEvent.fire( TextBoxPSG.this, getValue() );
          }
        } );
      }
    };
    t.schedule( 15000 );
  }

But this doesn't work -.- 

Any suggestions ? 
Thanks in advance  

--
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