Reputation: 169
I am unable to find a solution, also I cannot change data schema and i cannot have duplicated tbdoy because i use scrollable tbody so any one have any idea ?
<table class="table table-hover" id="grid">
<thead>
<tr>
<th>#</th>
<th><?php echo $conf->get('text.phone_number', 'Phone Number'); ?></th>
<th><?php echo $conf->get('text.group_subject', 'Group Subject'); ?></th>
<th><?php echo $conf->get('text.categories', 'categories'); ?> ...</th>
</tr>
</thead>
<tbody ng-repeat="data in shared.data">
<tr ng-repeat="group in data.groups" class="representor">
<td>{{$index+1}}</td>
<td>{{data.provider.number}}</td>
<td>{{group.subject}}</td>
<td ng-if="! group.categories"><a href="#" ng-click="addCategoryClick(group)">הוסף קטגוריה</a></td>
</tr>
</tbody>
</table>
Upvotes: 1
Views: 600
Reputation: 25034
Simply add another attribute to scope as myData
and add a method like :
$scope.getData = function() {
$scope.myData = [];
$scope.shared.data.forEach(function(sData){
sData.forEach(function(group){
$scope.myData.push({sData: sData, group: group});
});
});
}
and html modified to:
<tbody>
<tr ng-repeat="datum in getData()" class="representor">
<td>{{$index+1}}</td>
<td>{{datum.sData.provider.number}}</td>
<td>{{datum.group.subject}}</td>
<td ng-if="! datum.group.categories"><a href="#" ng-click="addCategoryClick(datum.group)">הוסף קטגוריה</a></td>
</tr>
</tbody>
doubt this would reduce the performance in a significant manner
Upvotes: 2