PDA

View Full Version : how to use Local Storage in sencha



mukund1a
10 Nov 2011, 1:16 AM
i have two piece of data i want to store it locally code for button handler

quizload:function(b,e){var form = Ext.getCmp('register');
form.submit({
url:'someurl.php'
method: 'POST',
success: function (frm, res) {
Ext.dispatch({
controller: 'quizloader',
action :'test',
data :res.a,
level:res.b
});
},
failure: function (frm, res) {
alert('Form no submit!');
}
});
}
where data and level are the data to store locally for the controller page
Ext.regController('quizloader',{
store: App.stores.quiz,
test:function(param){
this.store.create(param.data);//how to save both data here
}
});
store is
App.stores.quiz = new Ext.data.Store({
model:'quiz',
autoLoad: true,
});
controller is
App.models.quiz=Ext.regModel('quiz', {
fields: [
{name:'level',type:'int'}
,
{name:'data',type:'string'}
],
proxy: {
type: 'localstorage',
id : 'testuser'
}
});
how to proceed .

mitchellsimoens
10 Nov 2011, 4:33 AM
First, when you post code, please wrap in the BBCode code tags by highlighting the code and hitting the code button in the toolbar of the editor.

Using LocalStorageProxy is no different than using AjaxProxy or RestProxy.

mukund1a
11 Nov 2011, 1:57 AM
thanks