PDA

View Full Version : Filtered GridPanel looses filter



hoeriksen
15 Sep 2010, 12:39 AM
Hi,

I have a panel containing a TextField and a GridPanel. When the user enters text in the TextField, the contents of the GridPanel is filtered accordingly. The filter works in such a way that every time the user enters text, I send a GET request for a JSON file with the entered parameters, and the store for the GridPanel is loaded accordingly. The keystrokes are captured using keyup in the TextField. This works perfectly if the user is a slow typist. However, if the user enters text quickly, keyup doesn't capture all the keypresses. The result is that the user gets a correctly filtered list and then after a small delay (perhaps a half second), the Grid "pops" back and is filled with the complete list. This last action is not initiated by a request so it seems the grid falls back to its initial (default?) state. I have not been able to set any breakpoints in Firebug to intervene and capture this.
Does anyone have any ideas what might be happening here?

laurentParis
15 Sep 2010, 4:22 AM
you sayed that "The keystrokes are captured using keyup in the TextField", add same capture on blur event !

hoeriksen
16 Sep 2010, 4:06 AM
Thank you for the tip laurentParis! I (sort of) figured out the problem and made a workaround. It turned out that when I typed fast both my if and else statement got executed. My if statement said to filter and my else statement said to remove the filter and thus I first got the correct result and the after a small delay the filter was removed again.

Cheers,
Håvard