Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

smart-table Angular module unable to sort

I am unable to do a simple sort for my Smart Table Angular module. Shouldn't I just be able to add st-sort="propertyName" to my th?

JS:

var app = angular.module('app', []);

app.controller('SomeController', ['$scope', function($scope) {
  $scope.items = [{color:'red'},{color:'blue'}];
}]);

Html:

<html ng-app="app"><body ng-controller="SomeController">
  <table st-table="items">
    <thead>
      <tr>
        <th st-sort="color">Color</th>
      </tr>
    </thead>
    <tbody>
      <tr ng-repeat="item in items">
        <td>{{item.color}}</td>
      </tr>
    </tbody>
  </table>
</body></html>

If you click the Colors th, nothing happens and the data does not sort. What am I missing? Live demo here: http://jsbin.com/ganine/2/edit

like image 874
Ian Davis Avatar asked Sep 11 '26 15:09

Ian Davis


1 Answers

You should add a smart-table module dependency to you app module like this:

var app = angular.module('app', ['smart-table']);

See working example.

like image 158
PrimosK Avatar answered Sep 13 '26 17:09

PrimosK



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!