简体   繁体   English

服务器端分页,但以丢失排序为代价

[英]Server-side paging but at the cost of losing sorting

I have implemented server-side paging at 10 items per page for 1000 item result set, so that it pages 10 items per page. 我已经实现了服务器端分页,每页10个项目,可获取1000个项目的结果集,因此它每页可分页10个项目。 When I had it client side, I could page 10 at a time and if I sorted, it would sort against the entire 1000 items, but only show 10 items per page. 当我将其放在客户端时,我一次可以页面10个,如果排序,它将对全部1000个项目进行排序,但每页仅显示10个项目。 However, using server-side paging where my REST call only returns 10 items at a time, my sorting is only within 1 page at a time since it can't compare against the other 990 items that are not called yet. 但是,使用服务器端分页时,我的REST调用一次仅返回10个项目,因此我的排序一次仅在1页之内,因为它无法与尚未调用的其他990个项目进行比较。

Given this, how is it possible to have server side paging and sorting across the entire total items? 在这种情况下,如何在整个项目中进行服务器端分页和排序? This assumes I am using REST/JSON presented using AngularJS. 假设我正在使用通过AngularJS呈现的REST / JSON。

What is interesting is that in my REST call using a tool like Postman, it properly maintains the overall order even with skips, but with the pagination calls in my Angular app, it only orders within the items (ex. 10). 有趣的是,在使用Postman之类的工具进行REST调用时,即使跳过也可以正确维护总体顺序,但是在Angular应用中使用分页调用时,它仅在项目内进行排序(例如10)。

我发现了这个问题,我在REST调用中还有一些额外的代码仍在页面上与orderby冲突的页面上进行排序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM