使用数据分页器和数据网格获取特定成员
您好,
我有一个显示 PagedCollectionView 的 DataGrid,其中包含包含的记录总数。
我们总共有大约 4220 条记录,每页显示 20 条记录,我们大约有 210 页。
现在我一直在尝试实现这一点:
当我搜索一个人时,我想让这个人显示在页面顶部,并将页面设置为靠近其所在页面的任何内容。
我设法使用 Linq 获取高于姓氏的项目 < /a> 但是 PagedCollectionview 会被这些结果覆盖。由于这会跳过通缉人员之前的所有内容,因此页数会有所不同。
所以基本上我想要的是有一个搜索字段,我可以在其中输入“Jan”。然后我希望页面跳转到 Jan 可能所在的页面(+/- 1 页更低或更高),并将“Jan”作为第一个记录。
Greetings,
I have a DataGrid showing a PagedCollectionView which has the total amount of records included.
In total we have about 4220 records, with 20 records showing per page we have about 210 pages.
Now I've been trying to implement this:
When I search for a person I want to have this person show on top of the page AND have the page set to anything that is near the page it would be on.
I managed to get the person on top using the example given in Linq Get items higher then lastname however the PagedCollectionview gets overwriten by these results. Since this skips everything before the wanted person the amount of pages differs.
So basicly what I want is to have a searchfield where I can enter "Jan". And then I want the page to jump to the page where Jan could be (+/- 1 page lower or higher) and have "Jan" as first record.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找到了我自己的答案。
不是以一种非常好的方式,但是,由于在任何时候都首先加载成员的总数,所以我创建了一个检查来查看当前加载的金额是否高于首次加载的总数。
例如:
删除成员是为了确保在删除成员时它不会尝试设置页面索引,因此 TotalEntityCount 将比 itemcount 低 1。
Found my own answer.
Not in a very nice way but, since at all times firstly the total amount of members is being loaded, I created a check to see if the currently loaded amount is higher then the total amount first loaded.
Like:
The delete member is to make sure it doesn't try to set the page index when a member is deleted and thus TotalEntityCount would be 1 lower then itemcount.