ExtJs-基于远程数据的分页和缓冲网格,无需远程分页和过滤 [英] ExtJs - paging and buffering grid based on remote data WITHOUT remote paging and filtering

查看:98
本文介绍了ExtJs-基于远程数据的分页和缓冲网格,无需远程分页和过滤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ExtJs中,可以轻松地在页面网格中显示远程数据.但是要做到这一点,服务器端必须支持分页.此外,分页网格中的本地排序和过滤没有用,因为它仅过滤当前页面的元素.为了获得一致的结果,需要远程过滤和排序.对于无限滚动网格中的缓冲商店,同样适用.

In ExtJs, remote data can be easily displayed in a paged grid. But for this to happen, the server side must support paging. Furthermore, local sorting and filtering in a paged grid is not useful, because it only filters the elements of the current page. In order to get consistent results, remote filtering and sorting is required. For buffered stores in infinite scrolling grids the same applies.

但这并不总是正确的解决方案.尤其是当远程数据检索花费一些时间时,用户在过滤方面的体验将下降.同样,我们不能使用javascript函数进行过滤或排序.

But this is not always the right solution. Especially when remote data retrieval takes some time, the user experience on filtering will degrade. Also we cannot use javascript functions to filter or sort.

一种解决方案是让ExtJ一次读取所有数据,并使用该数据的本地副本对数据进行过滤和排序.我们需要一个用于整个数据集的中间存储,并且需要一个主存储链接到网格以显示数据.但这需要主代理将中间存储区作为数据源,据我所知,代理不能将另一个存储区作为数据源.

A solution would be to have ExtJs reading all the data at once, and use that local copy of the data to filter and sort the data. We would the need a intermediate store for the whole dataset, and the main store linked to the grid to display the data. But this would require that the main proxy has the intermediate store as datasource, and as far as I understand, a proxy cannot have another store as datasource.

有人知道如何解决此问题吗?我不确定草绘的解决方案是否可行,但是我需要以某种方式协调使用远程.json数据源并使用本地分页,过滤和排序.

Does someone have an idea how to solve this issue ? I'm not sure if the sketched solution is viable, but what I need is somehow to reconcile having a remote .json datasource and using local paging, filtering and sorting.

我该如何实现?

推荐答案

标题表达了真正的关注 ExtJs-基于远程数据的分页和缓冲网格,而没有远程分页和过滤,但详细信息这个问题是令人误解的.

While the title expresses the real concern ExtJs - paging and buffering grid based on remote data WITHOUT remote paging and filtering, but the details of the question is misleading.

实际上,有效解决方案是:而不是使用

In fact the working solution for this is : instead of using a buffered store, use the Bufferedrenderer.

BufferedRenderer仅影响显示,但不影响商店的工作方式.

BufferedRenderer only affects the display, but does not affect the way the store works.

  • 本地排序和排序虽然缓冲存储区不允许进行本地排序和排序,但是此解决方案并没有限制本地排序和排序.
  • 编辑:带缓冲的存储区不支持插入行或将存储区与服务器关联.在带有BufferedRenderer的网格中显示的普通存储没有这些限制.
  • Local sorting and ordering While a buffered store does not allow for local sorting and ordering, this solution does not put a limit on local sorting and ordering.
  • Editing: Buffered store do not support insert rows or synching the store with the server. A normal store that is displayed in a grid with BufferedRenderer has not these limitations.

BufferedRenderer有一个很好的解释在Sencha博客上

限制条件: 使用局部排序和过滤器只能实现无限滚动解决方案.始终(据我所知)分页必须在服务器上完成.远程分页还意味着远程过滤和排序.

Limitation: Only a infinite scrolling solution can be implemented with local sort and filter. Paging always (as far as I know) must be accomplished on the server. And remote paging also implies remote filtering and sorting.

这篇关于ExtJs-基于远程数据的分页和缓冲网格,无需远程分页和过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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