SpreadJS使用教程:SpreadJS自定义排序(中文排序)

SpreadJS V13.1 支持了自定义排序方法,可以通过回调函数compareFunction来自定义排序比较的逻辑。由此我们可以实现中文按照拼音排序,或者实现类似版本好的排序,比如1.1.10和12.1.0的比较。

SpreadJS最新试用版

实现自定义排序有两种方法

1. 调用sortRange时,sortInfo中添加compareFunction回调

如:

sheet.sortRange(1, 0, 8, 2, true, [    {index:0, ascending:true, compareFunction: pinyinCompare},   //Use the pinyin of column 0 to sort;])

2. 在RangeSorting事件中注入

如:

sheet.bind(GC.Spread.Sheets.Events.RangeSorting, function (e, info) {    //if(info.range is suited) {    info.compareFunction = compareSize;  // set the customize function.    //}});

想要购买SpreadJS正版授权,或了解更多产品信息请点击【咨询在线客服】
标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2020年5月19日
下一篇 2020年5月19日

相关推荐

发表回复

登录后才能评论