虚拟TableViewer排序导致选择问题 [英] Virtual TableViewer sorting causes selection problems

查看:611
本文介绍了虚拟TableViewer排序导致选择问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的应用程序是RCP应用程序,需要显示数千项目的表格。因此,我们在 TableViewer 中使用 SWT.VIRTUAL

Our application is an RCP appliction and needs to display table of several thousands items. For this reason, we're using SWT.VIRTUAL in our TableViewer. That works pretty well except for selection.

我们遇到以下问题:


  • 我们的 TableViewer 支持排序和过滤。当我们使用虚拟表视图时,更改选择不会保留当前所选项,而是当前选择的行。这将导致另一项被选中。
    例如:如果用户选择第5行出现的A,执行排序,则在排序后排列第5行的项目而不是A项。
    使用非虚拟 TableViewer ,一切正常。

  • Our TableViewer support sorting and filtering. When we use a virtual tableviewer, changing the selection does not preserve the current selected item but the row currently selected.This leads to another item being selected. e.g: If Item 'A' present at the 5th row is selected by user and sorting is performed, then after sorting the Item at the 5th row gets selected instead of the Item 'A'. Using a non virtual TableViewer, everything works fine.

我们试图进行调试,发现来自 AbstractTableViewer.VirtualManager 类的缓存似乎是最新的模型。
强制缓存在 AbstractTableViewer.virtualSetSelectionToWidget()中使用可能是一种可能的方法。

We tried to go into debug and found out that the cache from the AbstractTableViewer.VirtualManager class seems to be up to date with the model. Forcing the cache to be used in the AbstractTableViewer.virtualSetSelectionToWidget() can be a possible approach.

我们已尝试实施 https://bugs.eclipse.org中建议的解决方案/bugs/show_bug.cgi?id=338696 。但是它没有起作用。

We have tried to implement a solution suggested in https://bugs.eclipse.org/bugs/show_bug.cgi?id=338696. However it didn't work.

请建议一些指针或替代工作。

Please suggest some pointers or alternative work around.

感谢您的答案

推荐答案

作为使用巨大表格的解决方法,我建议您查看Nattable项目 http://www.eclipse.org/nattable/ 。它支持您需要的一切(排序,过滤,树结构元素,延迟加载等)。我们成功地在我们的项目中使用它,在那里需要显示数十万个元素作为一个大约160列的树。它还有一些非常酷的造型功能,这可以使您的表更加用户友好和互动。希望这有助于

As a workaround for working with huge tables I would suggest you to take a look at the Nattable project http://www.eclipse.org/nattable/. It supports everything you need (sorting, filtering, tree structured elements, lazy loading etc.). We successfully use it in our project, where it is necessary to display hundreds of thousands elements as a tree with around 160 columns. It also has some pretty cool styling features, which can make your table more user-friendly and interactive. Hope this helps

这篇关于虚拟TableViewer排序导致选择问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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