Hi All,
I have a very simple ng-repeat populating a table with json data. I've
followed the plunkr on Google's example but no matter how I code it, I only
see certain columns sorting both ways, while others will only sort asc.
Name is one of the problem fields. Any help is much appreciated.
*HTML:*
<table id="patientDataTbl" class="dataTable">
<tr>
<th ng-class="ng-click="sort('name', !direction)">Name</th>
<th ng-class="ng-click="sort('id', !direction)">ID</th>
<th ng-class="ng-click="sort('gender', !direction)">Gender</th>
</tr>
<tr ng-repeat="d in myData | orderBy:orderProp:direction"
ng-click="selectRow($index, d.id)" ng-class="{selectedItem:
$index==selectedRow && isSelected}">
<td>{{item.name}}</td>
<td>{{item.id}}</td>
<td>{{item.gender}}</td>
</tr>
*JavaScript Ctrl:*
// sort function for ng-repeat
$scope.sort = function(column, direction) {
console.log('sort with col: '+column+' and direction '+direction);
$scope.orderProp = column;
$scope.direction = direction;
};
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.