Wijmo5 FlexGrid教程(17)- 实现多列排序功能

发布时间:2016/06/28 00:06 发布者:Alice

返回博客中心

Wijmo5 flexgrid支持排序。

默认的wijmo5 flexgrid支持排序,当点击HeaderCell上的时候,可以进行升序,降序排序。

本文就来介绍如何进行多列排序。

进行多列排序,我们要使用的是CollectionView(接口请参考产品文档:http://demo.grapecity.com.cn/wijmo5/tutorialsample/topic/wijmo.collections.CollectionView.Class.html)。

可以使用它的SortDesciption定义排序(接口:http://demo.grapecity.com.cn/wijmo5/tutorialsample/topic/wijmo.collections.SortDescription.Class.html)。

多列排序代码参考:

  function MultiFilter() {
            grid.beginUpdate();
            var cv = grid.collectionView;
            var country = new wijmo.collections.SortDescription('country', true);
            var date = new wijmo.collections.SortDescription('date', true);
            var amount = new wijmo.collections.SortDescription('amount', true);
            cv.sortDescriptions.push(country);
            cv.sortDescriptions.push(date);
            cv.sortDescriptions.push(amount);
            
            cv.refresh()
            grid.endUpdate();
        }

排序效果如图所示:

image

 

本文所用的版本是Wijmo 2016V1。

源代码下载:

 

更多资源:

Wijmo中文官网:/developer/wijmojs

Wijmo5在线示例:/developer/wijmojscore

Wijmo5产品文档:/developer/wijmojscore

如果依然有问题,可以到我们的官方产品论坛发帖咨询:http://gcdn.grapecity.com.cn/showforum-140.html

请参考Wijmo5技术文章汇总

《wijmo5 flexgrid基础教程》系列文章


关于葡萄城

赋能开发者!葡萄城是专业的集开发工具、商业智能解决方案、低代码开发平台于一身的软件和服务提供商,为超过 75% 的全球财富 500 强企业提供服务。葡萄城专注控件软件领域30年,希望通过模块化的开发控件、灵活的低代码应用开发平台等一系列开发工具、解决方案和服务,帮助开发者快速响应复杂多变的业务需求,最大程度地发挥开发者的才智和潜能,让开发者的 IT 人生更从容更美好。

了解详情,请访问葡萄城官网