我在 extjs4 MVC 中工作,当我使用本地存储存储数据时遇到问题,我打算将代理类型从 ajax 动态更改为 localStorage。
将数据设置为 localstorage 后,出现错误 Uncaught TypeError: undefined is not a function。
我的模型:
Ext.define('Am.model.sn.UserModel',{
extend: 'Ext.data.Model',
//idproperty:'userId',//fields property first position pk.
fields: ['userId','firstName','middleName','lastName','languageId','primaryEmail','birthDate','password','securityQuestionId','securityQuestionAnswer','isMale','creationTime','ipAddress','confirmationCode','userStatusId']
});
我的控制器:
Ext.define('Am.controller.sn.UserController1',
{
init:function()
{
console.log('Initialized Users! This happens before the Application launch function is called');
this.control(
{
...
});
},
remeberMe : function()
{
console.log("check box selected");
var email=this.getUserName().getValue();
var password=this.getPassword().getValue();
console.log("email="+email);
var objCheckBox=Ext.getCmp('checkbox');
if(objCheckBox.getValue()==true)
{
window.localStorage.clear();
// Here I am getting error Uncaught TypeError: undefined is not a function
var lsProxy = new Ext.data.proxy.LocalStorage({
id: 'localp',
type:'localstorage',
});
var modelObject = Ext.ModelManager.create(
{
primaryEmail:email,
password: password,
proxy:lsProxy
}, 'Balaee.model.sn.UserModel');
modelObject.setProxy(lsProxy);
modelObject.save();
} else {
console.log("check box is not selected");
}
},
});
请给我建议...