I am working in extjs4 MVC, where I have a problem when I am storing data using a local storage, and I am going to change the proxy type dynamically from ajax to localStorage.
After setting the data to localstorage I got a error Uncaught TypeError: undefined is not a function.
My model:
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']
});
My controller:
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");
}
},
});
Please give me suggestion...