Dgrid

编程入门 行业动态 更新时间:2024-10-26 04:28:42
Dgrid - 如何在特定索引处启动行渲染(Dgrid - how to start row rendering at a specific index)

我正在使用带有Observable JsonRest存储的Dgrid。 JsonRest存储一次查询50行。 现在我有一个功能,用户可以“快速搜索”数据,并在服务器端处理搜索。 这是有效的,在这种情况下,服务器返回例如“Content-Range:210-260 / 1500”。 它返回50行数据,但Dgrid在开头呈现完整的网格,因此用户无法向上滚动以查找先前的条目。

我如何让Dgrid表现得那样?

I'm using Dgrid with an Observable JsonRest store. The JsonRest store is queried for 50 rows at a time. Now I have a function where the user can 'quicksearch' the data and the search is processed on the serverside. This works, and in this case the server returns for example "Content-Range: 210-260/1500". It returns 50 rows of data but Dgrid renders the full grid at the beginning, so the user can't scroll 'up' for previous entries.

How can I make Dgrid behave like that?

最满意答案

不完全确定我是否完全掌握了你的问题,但如果我是,那可能需要一些思维方式或妥协以获得你想要的东西。 我假设你的UI基本上是跳到第一场比赛,而不是简单地过滤网格只显示比赛。

如果您的UI始终存在并且搜索基本上用于滚动网格,则可以使用grid.scrollTo({ y: valueInPixels })来滚动网格。 虽然这会接受像素值(而不是行),但如果行的高度一致,则可以乘以grid.rowHeight (由OnDemandList设置的属性)来获取正确的偏移量。

另一种选择,虽然可能不是你想要的,但是可以使用分页扩展并导航到特定页面。

当然,如果您希望实际过滤网格以仅显示匹配项,那也是可能的(假设您的服务器表现为dojo/store/JsonRest预期,无论如何)。 使用网格和商店教程最后有一个例子。

Not entirely sure if I'm completely grasping your problem, but if I am, it may require some thinking outside the box or compromising to get what you want. I assume your UI is basically jumping to the first match rather than simply filtering the grid to only show matches.

If your UI is such that the grid is always present and the search is basically intended to scroll the grid, you can use grid.scrollTo({ y: valueInPixels }) to scroll the grid. While this accepts a pixel value (not rows), if your rows are consistent height, you can multiply by grid.rowHeight (which is a property set by OnDemandList) to get the correct offset.

Another option, though probably not what you want, would be to use the Pagination extension and navigate to a specific page.

Of course, if you would rather actually filter the grid to only display matching items, that's possible too (assuming your server behaves as dojo/store/JsonRest expects, anyway). The Using Grids and Stores tutorial has an example towards the end.

更多推荐

本文发布于:2023-08-05 20:42:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1439234.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Dgrid

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!