本文介绍了GWT CellTable 列排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用他们的 ListDataProvider 排序示例作为参考对 GWT 中的列进行排序

I am trying to sort on a column in GWT using their ListDataProvider Sorting example as a reference

http://code.google.com/webtoolkit/doc/最新/DevGuideUiCellTable.html#columnSorting

问题是我可以看到我的表列数据正在排序(通过使用调试器),但表永远不会刷新.查看上面链接中的示例,它们没有明确刷新显示.我在这里遗漏了什么吗?

The problem is I can see my table column data is getting sorted (by using the debugger) but the table never gets refreshed. Looking at the example in the above link they do not explicitly refresh the display. Am I missing something here?

谢谢.

推荐答案

我的经验表明,在创建 ListDataProvider 时,排序处理程序(即 ListHandler)对 List 很敏感.

My experience says sort handler (i.e. ListHandler) is sensitive to the List, which ListDataProvider has, when you are creating it.

所以我建议不要为 ListDataProvider 删除或设置新列表(当然我认为在创建时它至少应该有一个空(非空)列表).

So I recommend not to delete or set new List for ListDataProvider (of course I think it should has at least an empty (not null) list when you are creating).

只需使用 ListDataProvider.getList() 并完成您的工作.

Just use ListDataProvider.getList() and do your jobs on it.

例如删除所有当前行和设置新数据,只需调用 ListDataProvider.getList().clear() 然后 ListDataProvider.getList().addAll(yourNewData);不要调用 setList() 否则排序将不起作用.

For example for removing all current rows and setting new data, just call ListDataProvider.getList().clear() and then ListDataProvider.getList().addAll(yourNewData);do not call setList() or the sorting becomes not working.

这篇关于GWT CellTable 列排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 23:14
查看更多