TableViewer初始排序

发布于 2024-09-08 21:57:05 字数 306 浏览 2 评论 0原文

我在 RCP 中使用 JFace TableViewer 时遇到问题。基本上我有一个 4 行的表,作为输入,我给出了一个已经排序的元素列表。所以我希望输入列表中的第一个元素是表中的第一行。但是,TableViewer 会对元素重新排序,并显示它们按第一列的 DESC 顺序排序。由于我最初排序的值位于最后一列,这完全改变了我想要的值。

问题是:

  1. 是否有机会禁用 TableViewer 所做的排序?
  2. 如果不是,设置输入后排序的解决方案是什么?我有一个比较器集,可以对表头的选择做出反应,并对列进行排序,那么我可以使用它吗?

I have a problem with JFace TableViewer in RCP. Basically I have a table with 4 rows, and as input I give an already sorted list of elements. So I expect that first element in my input list is first row in a table. However, the TableViewer reorders the elements, and shows them sorted in DESC order for first column. Since the value I initially sorted is in last column, this totally changes what I want to have.

The questions are:

  1. Is there chance to disable this sorting that TableViewer does?
  2. If not, what would be the solution of sorting after the input has been set? I have a comparator set that reacts on selection of table header, and sorts the columns, so can I use this for example?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤独患者 2024-09-15 21:57:05

嗯,我的错误..我的比较器被初始化为按 DESC 顺序对第一列进行排序。很抱歉,实际上没有问题:)

Uf, my mistake.. My comparator was initialized to sort first column in DESC order. So sorry, there is actually no problem :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文