Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 在Angular.js中使用分页时无法按字母顺序对表数据进行排序_Angularjs_Sorting_Pagination_Dirpagination - Fatal编程技术网

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

Angularjs 在Angular.js中使用分页时无法按字母顺序对表数据进行排序,angularjs,sorting,pagination,dirpagination,Angularjs,Sorting,Pagination,Dirpagination,我有一个问题。我无法使用Angular.jsdir paginate按字母顺序对表数据进行排序。这里我需要对所有页面中的数据进行排序,但在最近的情况下,它是当前页面的排序数据。我在下面解释我的代码 <tbody id="detailsstockid"> <tr dir-paginate="cus in ($parent.labelResults=(listOfCustomerData | filter:searchProduct.rest_name)) | itemsPer

我有一个问题。我无法使用Angular.js
dir paginate
按字母顺序对表数据进行排序。这里我需要对所有页面中的数据进行排序,但在最近的情况下,它是当前页面的排序数据。我在下面解释我的代码

<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>

{{itemsPerPage*(当前页面-1)+$index+1}}
{{cus.rest_name}
{{cus.quadrant_name}
{{cus.city}
{{cus.proviance}}
{{cus.person}
{{cus.mobile}}
{{cus.url}
活跃的
不活跃的
对
不

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

第2页的餐厅名称是从上面给出的b开始的。这里我需要所有餐厅都按字母顺序排序,但不要按页面排序。请帮助我。

是的,你可以

要进行排序,请尝试对所有
客户数据列表进行排序

对于
分页
,您可以将其组合,而不是您的版本。

是的,您可以

要进行排序,请尝试对所有
客户数据列表进行排序


对于
分页
,您可以组合此选项而不是您的版本。

链接过滤器的顺序非常重要。当前正在排序前分页:

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

…因此排序只影响通过分页筛选器的未排序列表部分

在本例中,您只需交换该顺序,并在分页之前进行排序即可。现在,将首先对整个列表进行排序,然后将其拆分为单独的页面


…|orderBy:'rest_name'| itemsPerPage:5…

链接过滤器的顺序非常重要。当前正在排序前分页:

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

…因此排序只影响通过分页筛选器的未排序列表部分

在本例中,您只需交换该顺序,并在分页之前进行排序即可。现在,将首先对整个列表进行排序,然后将其拆分为单独的页面


…|orderBy:'rest_name'| itemsPerPage:5…

在分页之前您是否尝试过排序
orderBy:'rest_name'| itemsPerPage:5
而不是
itemsPerPage:5 | orderBy:'rest_name'
让我来做。@DanielBeck:是的,它开始工作了。谢谢。我会把它作为一个真实的答案而不是评论发布,以供将来参考。你在分页之前尝试过排序吗
orderBy:'rest_name'| itemsPerPage:5
而不是
itemsPerPage:5 | orderBy:'rest_name'
让我来做。@DanielBeck:是的,它开始工作了。谢谢。我会把它作为一个真实的答案而不是评论发布,以供将来参考。