PDA

View Full Version : data store in sencha



mukund1a
11 Nov 2011, 4:10 AM
i have the json file got from server

{
"success":"res",
"result":[["Questionno11",
"O1",
"O2",
"A1"
],
["Questionno2",
"O1",
"O2",
"A2"
]
]
}
in the form submit page

Ext.dispatch({
controller: 'quizloader',
action :'test',
record:res,

});
in the controller page

test:function(param){
console.log(param.test[0]);
console.log(param.record);
alert(param.record);
//some loop there
this.store.create(param.record);//param.record is probably error
//end loop
this.index();
},
I want to store the each question from the json separtly in localstorage
i have the model

App.models.quiz=Ext.regModel('quiz', {
fields: [
{name:'result',type:'auto'}
],

proxy: {
type: 'localstorage',
id : 'testuser'
}
});

mitchellsimoens
11 Nov 2011, 6:34 PM
You can try

http://docs.sencha.com/touch/1-1/#!/api/Ext.data.ArrayReader

and set the root as 'results'