刷新 AdvancedDatagrid 的 GroupCollection - 排序的 Arraycollection 被随机化
我有一个 AdvancedDatagrid,它由 ArrayCollection 填充。
我按日期(其属性之一)对 ArrayCollection 进行排序,因此它显示从过去到未来。问题是,如果我刷新 GroupingCollection(以便立即在数据网格中显示),在对 ArrayCollection 进行排序后,ArrayCollection 中的日期顺序会再次打乱,但会立即显示填充的 AdvancedDatagrid。
总而言之: from ArrayCollection >排序>刷新分组集合>填充 Adv.DataGrid,但 ArrayCollection 不再排序。
以前有人遇到过这样的障碍吗?
I have an AdvancedDatagrid which gets populated by an ArrayCollection.
I ordered the ArrayCollection by date (one of its properties), so it shows from past to future. The thing is, if I refresh the GroupingCollection (for immediate display in the datagrid) After the Sorting of the ArrayCollection, the ordering of the dates in the ArrayCollection gets scrambled again, but displays the populated AdvancedDatagrid immediately.
So in sum: from ArrayCollection > Sorting > Refresh the GroupingCollection > Populates the Adv.DataGrid, but the ArrayCollection is not sorted anymore.
Anybody stumbled on such an obstacle before?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
已解决:
gc.source = siteTrafficData;
gc.refresh();
adv_dg.validateNow();
var sort:Sort = new Sort();
sort.fields = [new SortField("日期")];
IHierarchicalCollectionView(adv_dg.dataProvider).sort = 排序;
IHierarchicalCollectionView(adv_dg.dataProvider).refresh();
}
Solved:
gc.source = siteTrafficData;
gc.refresh();
adv_dg.validateNow();
var sort:Sort = new Sort();
sort.fields = [new SortField("date")];
IHierarchicalCollectionView(adv_dg.dataProvider).sort = sort;
IHierarchicalCollectionView(adv_dg.dataProvider).refresh();
}
对 DataGrid 而不是 dataProvider 进行排序 - 更改视图,而不是模型。将网格的
sortableColumns
属性和列的sortable
属性设置为true
。使用sortCompareFunction
如有必要,列的属性。Sort the DataGrid instead of the dataProvider - change the view, not the model. Set the
sortableColumns
property of the grid andsortable
property of the column totrue
. Use thesortCompareFunction
property of the column if necessary.