PDA

View Full Version : [CLOSED] how to fire enter event when click in the textfield?



hdsoso
May 25, 2014, 5:11 PM
how to fire enter event when click in the textfield?


<ext:TextField runat="server" ID="tf_prov" FieldLabel="省" LabelWidth="30" EmptyText="请输入省" EnableKeyEvents="True">
<Listeners>
<KeyUp Handler="
alert(item);
alert(e);
">
</KeyUp>
</Listeners>
</ext:TextField>

geoffrey.mcgill
May 25, 2014, 11:28 PM
How about the <Focus> Listener?

hdsoso
May 26, 2014, 2:01 AM
i think should use keyup event , becuase i want to type something in the textfield , then accord to the typed character to change the treepanel,
how to capture the event which i press the "enter" key ?


function ( item, e )

Daniil
May 26, 2014, 6:48 AM
Hi @hdsoso,

You can use a SpecialKey event.
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.form.field.Base-event-specialkey

Example

<ext:TextField runat="server">
<Listeners>
<SpecialKey Handler="if (e.getKey() === e.ENTER) {
console.log('ENTER');
}" />
</Listeners>
</ext:TextField>