Jul 08, 2014, 11:25 AM
[CLOSED] TriggerField and Enter key
I have a TriggerField with EnableKeyEvent true.
When I press a key, a filtered search is launched and below the TriggerField
a filtered TreePanel is loaded. It works fine, but I would like
to disable the ENTER key. At the moment, when I have the focus in TriggerField
and I press ENTER key, the whole page is reloaded and the whole Tree too. I simply
would like that nothing happens when I press ENTER key.
This is the piece of Code:
The code enters in the IF part, but it reloads the page all the same.
Any idea?
Many thanks
When I press a key, a filtered search is launched and below the TriggerField
a filtered TreePanel is loaded. It works fine, but I would like
to disable the ENTER key. At the moment, when I have the focus in TriggerField
and I press ENTER key, the whole page is reloaded and the whole Tree too. I simply
would like that nothing happens when I press ENTER key.
This is the piece of Code:
var filterTree = function (tf, e) {
............
if (e.getKey() == Ext.EventObject.ENTER) {
e.stopEvent();
return false;
}else {
var re = new RegExp(".*" + text + ".*", "i");
tree.filterBy(function (node) {
return re.test(node.data.text);
});
}
};
<ext:TriggerField
ID="TriggerField1"
runat="server"
EnableKeyEvents="true">
<Triggers>
<ext:FieldTrigger Icon="Clear" />
</Triggers>
<Listeners>
<KeyPress Fn="filterTree"></KeyPress>
</Listeners>
</ext:TriggerField>
Neither stopEvent, nor return false, seem to work.The code enters in the IF part, but it reloads the page all the same.
Any idea?
Many thanks
Last edited by Daniil; Jul 08, 2014 at 1:03 PM.
Reason: [CLOSED]