I am working in extjs4 MVC. Where i am getting stuck at a point*.Which is how to define object array in extjs4 and set values to it as well as retrieve values from that object.*I am tried but not yet solved.
Suppose I have Qusetion paper.Which displays some question with there options.I have got qustion with proper selected option.But I am not succeed to store it in proper models instance.I know how to store single record to particular model instance.But I dont know how to store repetative values to a particular model object.How I solve this probelm.
1) here is my some contrller file code
temp:function()
{
var obj = Ext.create('Demo.model.Poll');
for(var i=0;i<4;i++)
{
var inputs = document.getElementsByName(i);
var radio = "";
for (var j = 0; j < inputs.length; j++) {
if (inputs[j].checked) {
name = inputs[j].name;
value = inputs[j].value;
//console.log("questionId="+name +" value="+ value);
check.set('poll',name);
check.set('option',value);
}// End of if statment
}// End of inner for loop
}//End of outer for loop
//Here I am going to display values inside object
console.log("----------------------------------");
for(var i=0;i<4;i++)
{
console.log(i);
console.log(check.get('poll'));
console.log(check.get('option'));
}
//Is it possible to save object array to server side in single save method
// obj.save();
}// End of temp function
2) And after running this code i got last set value to model.In firebug i got this result.
for exampl.
3
England
3
England
3
England
3
England
please give me some suggestion
I have found the solution to my question and here is the answer.