Results 1 to 2 of 2

Thread: textfield delayed keypress events

  1. #1
    Sencha User
    Join Date
    Nov 2009
    Posts
    127

    Default textfield delayed keypress events

    I have a textfield which is used to filter thousands of records. In the backend I used something like a SQL LIKE 'blah%' to incrementally display the results according to the match.

    As it stands inside keypress of the textfield I update the store for the listbox which is to be filtered. Unfrotunately the event fires almost instananeously and it stresses the server just a little more than needed, so I would like to implement a second or 2 time delay between event firing.

    http://www.extjs.com/deploy/dev/docs/

    Does not appear to have a configuration option for setting delays in any key events, so the second option is to maybe use setTimout() however I think I will encounter errors in accessing the data store object from inside the context of a setTimeout() -- is there a work around???

    Cheers,
    Alex

  2. #2
    Sencha User aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,488

    Default

    Ext provides you with a configuration buffer for addListener and on (buffer).

    This configuration gives you the exact behavior that you are looking for. Each time an event occurs it cancels out the latest pending event if they happen within the 'buffer' configuration.
    Aaron Conran
    @aconran

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •