PDA

View Full Version : How do I trap the enter key in the paging toolbar search field?



ccoley3910
18 Feb 2008, 10:28 AM
I'm an Ext newbie and I am using alpha 1 code and would like to implement a search button click whent the enter key is trapped inside the search field? I saw this functionality I believe in the Beta 1 code stream but upgrading to it for me was a nightmare (I tried twice and had problems in each instance) thus I would like to implement the code, becuase it sounds like it might be easier.

RWaters
18 Feb 2008, 11:48 AM
hmm, the listener in beta 1 is using the new syntax to declare it inline. Basically you'll want to add a 'specialkey' listener to to the searchbox. You can probably use the same key handler we do:


handleViewSearchKey: function(field, e) {
e.preventDefault();
if (e.getKey() == Ext.EventObject.ENTER) {
this.handleViewSearch();
}
},

jratcliff
18 Feb 2008, 1:35 PM
... I saw this functionality I believe in the Beta 1 code stream but upgrading to it for me was a nightmare (I tried twice and had problems in each instance) ...

The preference would be for you to move to Beta 1 since that would provide you with the latest fixes and make it easier for us to give you support. What exact problems did you have? The Beta version is far simpler to implement than the Alpha version. It's actually quite shocking that you say it was a "nightmare" and it sounds like you didn't even get it to work.