Perhaps this is a question that pertains to using pure JavaScript, but for some reason I can't seem to figure it out. I am currently working on extjs4.2 using Sencha Architect and have received a JSON response from the server in the following format:
{
"data": [{
"ExamID": 1,
"ExamName": "Semester-1",
"MaxMarks": 100
}, {
"ExamID": 4,
"ExamName": "Test-1",
"MaxMarks": 10
}, {
"ExamID": 5,
"ExamName": "Test-2",
"MaxMarks": 10
}]
}
My goal is to reconfigure the grid using only the data from the "ExamName" field. Therefore, "ExamName" should be passed as an array in the reconfigure() function.
Unfortunately, I am struggling to retrieve "ExamName" in array form. Any assistance you can provide would be highly appreciated.
var gridStore = Ext.data.StoreManager.get('ClassSemesterStore');
var g = gridStore.load( {params : {ClassID: ClassData }});
var data = g.data;
var length = data.getCount();
var examName = [];
for(var i = 0; i < length; i++){
examName.push(data[i]['ExamName']);
}
This is resulting in an error message stating "Uncaught TypeError: Cannot read property 'ExamName' of undefined".