tbar:[{xtype:'textfield',id:'searchKeyAT',width:120},'-',
{id : 'searchBtnAT', text : '查询' },handler:function(......)
]
现在我想实现这样的方法不知可不可以,
当在文本框输入完后,敲回车键就可以进行查询 。
{id : 'searchBtnAT', text : '查询' },handler:function(......)
]
现在我想实现这样的方法不知可不可以,
当在文本框输入完后,敲回车键就可以进行查询 。
sure!
tbar:[{xtype:'textfield',id:'searchKeyAT',width:120,
listeners:{
specialkey: function(field, e){
//e.ENTER = Ext.EventObject.ENTER
if (e.getKey() == e.ENTER){
alert("key enter");
}
}
} },'-',
{id : 'searchBtnAT', text : '查询' },
]
//注意下面的方法,只能这样写。如果在listeners中keypress就会无效
Ext.get("searchKeyAT").on("keypress", function (e) {
alert(e.target + ":" + e.getKey());//回车e.getKey() == 13 })
xtype:"textfield",
listeners:{
foucs:function(){//获得焦点时
KM = new Ext.KeyMap(document, {
key: Ext.EventObject.ENTER,
fn: function() {
//回车执行的操作
}
});
},
blur:function(){
KM.setDisabled(true);
}
}
}