I am using AngularJS. I am able to make single table with <tbody ng-repeat="subject2class in vm.sectionListWithClass" >
but how to group col Class Standard to avoid repeat. What to achieve without restructuring JSON array
Want like this... grouping class and TWO row of each section if there is two type of subject main and option
| Class Standard |Class Section |Class Section Name |Subjects
|---------------------------|------------------------------------------------------------------------------------------------
| Prep-2015 |A |ROSEs |Main Subject: Chemistry, Physics
| |------------------------------------------------------------------------------------------------
| |B |RED |
| |--------------------------------------------------------------------------------------------------
| |C |green |
|-----------------------------------------------------------------------------------------------------------------------------
| NUR |A |ROME |
| |--------------------------------------------------------------------------------------------------
| |B |PARIS |
|-----------------------------------------------------------------------------------------------------------------------------
| STD-1s |A |DON |Optional Subjects: P.T, 3rd
|-----------------------------------------------------------------------------------------------------------------------------
| STD-6 |A |ROCKS |Main Subject: Chemistry, Physics,
| | |---------------------------------------------
| | | |Optional Subjects: 3rd lang German
|------------------------------------------------------------------------------------------------------------------------------
My JSON array is like this
[
{
"classStd": "Prep-2015",
"classId": "1",
"section": "A",
"sectionName": "ROSEs",
"sectionId": "5",
"mainSubjectAllocationList": "Chemistry, Physics",
"mainSubjectAllocationId": "25",
"optionSubjectAllocationList": "",
"optionSubjectAllocationId": ""
}
]
<table class="formatHTML5">
<!-- TABLE HEADER-->
<thead>
<tr>
<th>Class Standard</th>
<th>Class Section</th>
<th>Class Section Name</th>
<th>Main Subjects </th>
</tr>
</thead>
<!-- TABLE BODY: MAIN CONTENT-->
<tbody ng-repeat="subject2class in vm.sectionListWithClass" >
<tr >
<td ><a ui-sref="classEdit({classId: subject2class.classId})"> {{subject2class.classStd}}</td>
<td><a ui-sref="sectionEdit({sectionId: subject2class.sectionId})"> {{subject2class.section}}</a></td>
<td><a ui-sref="sectionEdit({sectionId: subject2class.sectionId})"> {{subject2class.sectionName}}</a> </td>
<td> <b ng-hide="!subject2class.mainSubjectAllocationList">Main Subject: </b><i class="glyphicon glyphicon-edit" ng-hide="!subject2class.mainsubjectName"></i>
<a ui-sref="subjectAllocationEdit({allocationId:subject2class.mainAllocation, classId: subject2class.classId, sectionId: subject2class.sectionId, Type:'main'})">
{{subject2class.mainSubjectAllocationList}}</a><br ng-hide="!subject2class.mainsubjectName"><br>
<b ng-hide="!subject2class.optionSubjectAllocationList">Optional Subjects: </b><a ui-sref="subjectAllocationEdit({classId: subject2class.classId, sectionId: subject2class.sectionId, Type:'optional', allocationId:subject2class.optionalAllocation})">
<i class="glyphicon glyphicon-edit" ng-hide="!subject2class.optionSubjectAllocationList"></i></a>
{{subject2class.optionSubjectAllocationList}}</td>
</tr>
</tbody>
</table>