[英]glazed lists - default sorting?
I'm working with the Glazed List tutorial found here and here , but the implication is that you need a comparator to sort rows. 我正在使用这里和这里找到的Glazed List教程,但暗示你需要一个比较器来排序行。 However, I can't seem to figure out how to add support for sorting based on table header clicks.
但是,我似乎无法弄清楚如何根据表标题点击添加对排序的支持。
After more trial and error, I've found what I was doing wrong. 经过更多的反复试验,我发现了我做错了什么。
The EventTableModel
must be instantiated with the SortedList
instance, not the EventList
. 必须使用
SortedList
实例而不是EventList
实例化EventTableModel
。 From the example: 从示例:
private EventList<Issue> issuesEventList = new BasicEventList<Issue>();
...
SortedList<Issue> sortedIssues = new SortedList<Issue>(issuesEventList, null);
// create a panel with a table
JPanel panel = new JPanel();
// be careful not to put issuesEventList in here, it has to be the sortedIssues list
EventTableModel<Issue> issuesTableModel = new EventTableModel<Issue>(sortedIssues, new IssueTableFormat());
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.