在 Angular.js 中使用分页时无法按字母顺序对 table 数据进行排序

Can not sort table data alphabetically while using pagination in Angular.js

我有一个 issue.I 无法使用 Angular.js dir-paginate 按字母顺序对 table 数据进行排序。这里我需要对所有页面的数据进行排序,但最近调整当前的排序数据 page.I 我在下面解释我的代码。

<tbody id="detailsstockid">
 <tr dir-paginate="cus in ($parent.labelResults=(listOfCustomerData  | filter:searchProduct.rest_name)) | itemsPerPage:5 | orderBy:'rest_name' track by $index" current-page="currentPage">
 <td>{{itemsPerPage *(currentPage-1)+$index+1}}</td>
<td>{{cus.rest_name}}</td>

 <td>{{cus.quadrant_name}}</td>
<td>{{cus.city}}</td>
 <td>{{cus.proviance}}</td>

<td>{{cus.person}}</td>
<td>{{cus.mobile}}</td>
<td>{{cus.url}}</td>
    <td ng-if="cus.status==1">Active</td>
 <td ng-if="cus.status==0">Inactive</td>
<td ng-if="cus.premium==1">Yes</td>
 <td ng-if="cus.premium==0">No</td>
<td >
<a ui-sref="dashboard.customer.view">
<input type='button' class='btn btn-xs btn-green' value='Edit' ng-click="editProductViewData(cus.member_id);">  
</a>
</td>
<td>
<a ui-sref="dashboard.customer.view">
<input type='button' class='btn btn-xs btn-red' value='Delete' ng-click="deleteProductInfoData(cus.member_id);" >  
</a>
</td>
</tr>   
</tbody>

在这种情况下,我只能对当前页面数据进行排序,但我需要对总数组 (i.e-listOfCustomerData) 中的数据进行排序。我在下面附上我的输出。

在上图中,餐厅名称以 c 开头,这是第 1 页的图片。

对于第 2 页,餐厅名称从给定的 b 开始 above.Here 我需要所有餐厅都应按字母顺序排序,但不是按照 page.Please 帮助我。

是的,你可以!

对于排序尝试 this 这将适用于所有 listOfCustomerData

对于 pagination 你可以组合这个 example 而不是你的版本。

链接过滤器的顺序很重要。目前您正在排序前分页:

 <tr dir-paginate="... | itemsPerPage:5 | orderBy:'rest_name' ...">

...所以排序只影响通过分页过滤器的未排序列表部分。

在这种情况下,您只需交换该顺序,然后在分页之前进行排序。现在整个列表将首先排序,然后拆分为单独的页面。

... | orderBy:'rest_name' | itemsPerPage:5 ...