Search code examples
angularjsangular-ui-gridng-gridui-grid

Angular UI-GRID: Loop through array of JSON objects


Please help... I have array of objects, having some attributes and corresponding values. Example: Various types of scores for the group of students. Each score_object has a result, test name (math, english, biology et cetara) and test group name (literature, sciences et cetera). All the score_objects are placed in a array called scoreArray.

To get student1's first test result, I am just giving static index of the array. e.g., scoreArray[0].score_object.result. Please let me know how can we loop though an array and get corresponding results dynamically.

Problem State: Each student can have so many score_objects within his/her score array. So many test types- couldn't really do static indexing.

Resultant UI should be as follows:

      testtype1  testtype2  testtype3

Student1 result result result student2 result result result . . .


Solution

  • Did you try it with
    http://ui-grid.info/docs/#/tutorial/209_grouping or
    http://ui-grid.info/docs/#/tutorial/215_treeView
    There you can List your Students and then expand the Results of each one?