为了账号安全,请及时绑定邮箱和手机立即绑定

extjs函数调用方法?

extjs函数调用方法?

慕盖茨4494581 2019-02-05 10:06:06
init: function() {this.control({'userlist textfield[id=searchId]':{keyup:function(textfield, e){if (e.getKey() == 13) {this.searchUserByEnter //此处该如何调用searchUserByEnter 所标记的方法}}}}searchUserByEnter:function(textfield){alert('call search function')var grid = textfield.ownerCt.ownerCt,store =grid.getStore(),tbar=textfield.ownerCt,searchInfo= tbar.down('textfield').getValue();store.on('beforeload', function (store, options) {var param = {param:searchInfo};Ext.apply(store.proxy.extraParams, param);});var pagebar = grid.down('pagingtoolbar');pagebar.movePrevious();grid.getStore().load({params:{ start:0, limit:5}});}
查看完整描述

2 回答

?
眼眸繁星

TA贡献1873条经验 获得超9个赞

当前this所引用的作用域已经改变了,可简单修改为
init: function() {
var me = this;//保存作用域
this.control({
'userlist textfield[id=searchId]':{
keyup:function(textfield, e){

if (e.getKey() == 13) {
me .searchUserByEnter(textfield); //调用原作用域方法
}
}
}
}
规范点可参照extjs写成scope参数控制this



查看完整回答
反对 回复 2019-03-14
  • 2 回答
  • 0 关注
  • 927 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信