分组后排序问题
这是我未分组的高级数据网格, 替代文本 http:// 1.bp.blogspot.com/_T_-j3ZLqfNQ/TE-bkKh76uI/AAAAAAAABqg/65dHe-tzj1A/s1600/4.PNG
一旦我应用分组,排序就会丢失,请参见下文, 替代文本 http://3. bp.blogspot.com/_T_-j3ZLqfNQ/TE-bqbDQr4I/AAAAAAAABqo/InBWCerJ3H4/s1600/5.PNG
这是在分组完成并将 GroupingCollection 分配给网格后应用的代码段。
//Sorting grid once grouping done
dataGrid.validateNow();
var s:Sort = new Sort();
s.fields = [new SortField("hazardnum")];
s.compareFunction = hazardSortItems;
dataGrid.dataProvider.sort=s;
dataGrid.dataProvider.refresh();
这是我的比较函数,
private function hazardSortItems(a:Object, b:Object,fields:Array=null):int {
return ObjectUtil.stringCompare(a.hazardnum.toString(),b.hazardnum.toString(),false);
}
Here is my advance data grid without grouping ,
alt text http://1.bp.blogspot.com/_T_-j3ZLqfNQ/TE-bkKh76uI/AAAAAAAABqg/65dHe-tzj1A/s1600/4.PNG
Once I apply grouping, sorting is getting lost, see below ,
alt text http://3.bp.blogspot.com/_T_-j3ZLqfNQ/TE-bqbDQr4I/AAAAAAAABqo/InBWCerJ3H4/s1600/5.PNG
Here is piece of code which is applied after grouping is done and the GroupingCollection is assigned to the grid.
//Sorting grid once grouping done
dataGrid.validateNow();
var s:Sort = new Sort();
s.fields = [new SortField("hazardnum")];
s.compareFunction = hazardSortItems;
dataGrid.dataProvider.sort=s;
dataGrid.dataProvider.refresh();
Here is my compare function,
private function hazardSortItems(a:Object, b:Object,fields:Array=null):int {
return ObjectUtil.stringCompare(a.hazardnum.toString(),b.hazardnum.toString(),false);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论