GWT CellTable 排序 - 如何使用排序后的值?

GWT CellTable sorting - how to use sorted values?

我已经创建了一个 ListHandler 并且我正在覆盖它的 setComparator 方法来为我的 CellTable 中的每个 TextColumn 提供基本的字母排序。

下面是一个这样的例子:

private void createTargetColumnSortHandler()
    {
    ListHandler<RegradeRule> targetColumnHandler = new ListHandler<RegradeRule>(resultsTableDataProvider.getList());
    targetColumnHandler.setComparator(this.targetPromotionColumn, new Comparator<RegradeRule>()
        {
        @Override
        public int compare(RegradeRule o1, RegradeRule o2)
            {
            if (o1 == o2)
                {
                return 0;
                }
            // Compare the name columns.
            if (o1 != null)
                {
                return (o2 != null) ? o1.getTargetPromotion().compareTo(o2.getTargetPromotion()) : 1;
                }
            return -1;
            }
        });
    this.resultsTable.addColumnSortHandler(targetColumnHandler);
    }

在 GUI 中,单击列启动排序后,如何检索排序后的值?或者换句话说,什么存储排序后的值?调试时我似乎无法捕获此点击事件(或找不到合适的 breakpoint),因此我找不到排序后的值 - 例如,如果它是 ListDataProvider 中使用的我的 CellTable

编辑 CellTable 完美呈现排序后的值。我只想使用排序后的值并导出到 Excel(我可以导出未排序的值就好了)

ListHandler will sort the list that you provide in the constructor. You have passed the list backed by the ListDataProvider,所以你会在那里找到你的排序列表:

resultsTableDataProvider.getList();