I want to sort a table when a checkbox is clicked and be able to filter the table also but I can't get the checkbox to sort and I can't find an example anywhere to do this.
HTML
<table>
<tr ng-repeat="x in myArray | orderBy : sortOrder">
<td></td>
<td></td>
</tr>
</table>
<input type="checkbox" ng-model="sortByName">
<input type="text">
AngularJS
app.controller("myController", function($scope, $http)
{
$scope.filterString = '';
$scope.sortByName = false;
$scope.sortOrder = '';
$scope.setSortOrder = function()
{
//element(by.model('sortByName')).click();
if($scope.sortByName)
{
$scope.sortOrder = 'name';
}
else
{
$scope.sortOrder = '';
}
}
Aucun commentaire:
Enregistrer un commentaire