sorttable.js not sorting the columns populated using ng-repeat

58 views Asked by At
<div id="collapseThree-2" class="panel-collapse collapsexpanded="false">
   <table class="table table-hover hd-bg table-bordered;sortable">
      <thead align="center">
         <tr>
            <th>Request ID</th>
            <th>Request Type</th>
            <th>Initiator</th>
            <th>Product</th>
            <th>Version</th>
            <th>Submission Date</th>
            <th>Stage</th>
         <tr>
      <tbody ng-repeat = "x in requestData">
         <td ng-bind = "x.id"></td>
         <td ng-bind = "x.type_of_request"></td>
         <td ng-bind = "x.initiator_name"></td>
         <td ng-bind = "x.product_name"></td>
         <td ng-bind = "x.product_version"></td>
         <td ng-bind = "x.submission_date"></td>
         <td ng-bind = "x.status_flag"></td>
      </tbody>
      </thead>
   </table>
</div>

Here, i am using sottable.js, but still not able to find the sorting options on columns.As, i am using sorttable.js, so by default it needs to come up with sorting options on the columns of the table.

1

There are 1 answers

0
Parth Raval On

You need to bind array of object like this

$scope.sortColumn = {
   Column: 'c1', // name of column
   reverse: false // order 
};

html Code:-

<th ng-repeat="object in objects">
    <a ng-click="columnSort.sortColumn=objects[$index];columnSort.reverse=!columnSort.reverse">{{ objects[$index] }}</a>
</th>

please find fiddle