猿问

extjs函数调用方法?

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}
});
}

慕盖茨4494581
浏览 957回答 2
2回答

眼眸繁星

当前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
随时随地看视频慕课网APP
我要回答