我只是试图更新本地存储,但内部的Ext.Ajax.request我无法调用this.store.create()。如何在Ajax调用的success:区域内调用this.store.create函数。非常感谢您的帮助。this.store.create不会在ajax内呼叫
login: function(params) {
params.record.set(params.data);
var errors = params.record.validate();
if (errors.isValid()) {
var myMask = new Ext.LoadMask(Ext.getBody(), {msg:"Please wait..."});
myMask.show();
//now check if this login exists
Ext.Ajax.request({
url: '../../ajax/login.php',
method: 'GET',
params: params.data,
form: 'loginForm',
success: function(response, opts) {
var obj = Ext.decode(response.responseText);
myMask.hide();
//success they exist show the page
if(obj.success == 1){
//this doesn't work below
this.store.create(params.data);
this.index();
}
else{
Ext.Msg.alert('Incorrect Login');
}
},
failure: function(response, opts) {
alert('server-side failure with status code ' + response.status);
myMask.hide();
}
});
}
else {
params.form.showErrors(errors);
}
},
什么是错误?你会得到一个JavaScript异常吗?这可能是一个范围问题,你的“这个”指针可能并不指向你的想法。此外,文档提到了商店的添加方法,但不是创建。您使用的是哪种版本的sencha touch? –
即时通讯使用sencha 1.1我想我需要引用商店的完整商店名称?即:loginDetails.store.create(params.data);那是对的吗? –