如何仅在当前页面中过滤数据 [英] How to filter data in current page only

查看:72
本文介绍了如何仅在当前页面中过滤数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 igx-grid .我正在一次调用中检索所有数据,假设我在第3页上,同时过滤数据时会从整个数据中搜索数据,然后转到第1页".自动,我需要一种仅在当前页面上过滤数据并且不分页到第1页的方法,它应该仅在当前页面上.有什么办法可以做同样的事情吗?预先谢谢!!!

I am using igx-grid. I am retrieving all data in one call, suppose I am on 3rd page, while filtering data it searching the data from the whole data, and it goes to "Page 1" automatically, I need a way to filter data in current page only and don't paginate to Page 1, it should be on current page only. Is there any way to do the same? Thanks in advance!!!

我在服务器端分页中也遇到相同的问题.

I am facing same issue in Server Side Pagination also.

推荐答案

igx-grid 的任何列中的数据执行的过滤不是仅适用于特定页面数据的操作,但在整个数据集上如果只需要过滤当前页面中的数据,那么当前页面中的数据将小于页面大小,并且网格中的数据状态通常将不同步.

Filtering performed on the data in any column of the igx-grid is not an operation which works only on the specific page data, but on the entire data set. If you need only data within the current page to be filtered, then the data within the current page will be less than the page size and the data state in general in the grid will go out of sync.

为了通过服务器端分页获得当前页面上的当前过滤数据,您可以从网格中提取 filteringExpressions 并将其在分页请求中发送给后端服务.然后首先过滤数据,然后分页并仅返回页面大小.在伪代码中,它将类似于:

In order to get the current filtered data on the current page with server-side paging, you can extract the filteringExpressions from the grid and send them in the request for paging to your backend service. Then first filter the data and subsequently page it and return only the page size back. In pseudo code this will look something like:

data.Where(d => d.something meets condition).Skip(page).Take(pageSize)

结果将是这样的: https://stackblitz.com/edit/github-w6x6a7?file=src/app/grid/grid-remote-paging-defaultTemplate-sample/remote-paging-default-template.component.html

现在,在执行客户端筛选时,网格确实会重置页面,因为在筛选数据时,页面数会减少,并且用户所在的当前页面可能不再存在.

Now the grid does reset the pages when client-side filtering is performed, because when filtering the data, the number of pages is reduced and the current page that the user is on may no longer exist.

igx-grid 中的服务器端分页和过滤的示例可以在以下位置找到: https://www.infragistics.com/products/ignite-ui-angular/angular/components/grid/remote-data-operations

Examples on the server-side paging and filtering in the igx-grid can be found here: https://www.infragistics.com/products/ignite-ui-angular/angular/components/grid/remote-data-operations

这篇关于如何仅在当前页面中过滤数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆