【问题标题】:sorttable.js not sorting the columns populated using ng-repeatsorttable.js 没有对使用 ng-repeat 填充的列进行排序
【发布时间】:2018-04-04 07:28:59
【问题描述】:
<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>

在这里,我使用的是 sottable.js,但仍然无法找到列上的排序选项。因为,我使用的是 sorttable.js,所以默认情况下它需要在表格的列上提供排序选项.

【问题讨论】:

    标签: angularjs sorttable.js


    【解决方案1】:

    你需要像这样绑定对象数组

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

    html代码:-

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

    please find fiddle

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-11-30
      • 1970-01-01
      • 2022-12-26
      • 1970-01-01
      • 2013-05-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多