无法使用AngularJs提供的“OrderBy”过滤器对列进行排序

时间:2016-09-24 11:23:14

标签: javascript html angularjs

我已经尝试运行下面的代码没有成功请有人帮助我看不到任何错误,但它没有排序列尝试不同的方式,并没有成功。

<table >
        <thead>
        <tr>
        <th class="textalignleft" ><a href="" ng-click="predicate = 'FirstName'; reverse=!reverse">Name</a></Name
        </th>
        <th class="textalignleft" ng-repeat="col in selcolumns" ng-class="selectedCls(col)" ng-click="changeSorting(col)" >{{selcolumns[$index]}}
        </th>
        </tr>
        </thead>
        <tbody>
        <tr data-ng-repeat="person in ItemsByPage[currentPage] | orderBy:columnToOrder:reverse" data-ng-class-odd="'odd'" data-ng-class-even="'even'">
        <td>
        {{person.FirstName}} {{person.LastName}}
        </td>
<td ng-repeat="col in selcolumns">
<span ng-switch on =col>
<span ng-switch-when="Email">{{person.Email}}</span>
<span ng-switch-when="MobileNumber">{{person.MobileNumber}}</span>
            <span ng-switch-when="OfficeName">{{person.Firm}}</span>    
            <span ng-switch-when="OfficeFaxNumber">{{person.OfficeFaxNumber}}</span>



            <span ng-switch-when="Functions"><span ng-repeat="Function in person.Functions"><span ng-if="$index > 0">;</span> {{Function.Function}}</span>
</span>


</span>
        </td>
        </tr>
        <tbody>
        </table>

0 个答案:

没有答案