我正在尝试在资源规划工具中返回一个句点列表(周)。目前我正在返回数据和订购,但linq.js按字母顺序排序并返回1,11,12,3 ......
如何修改查询以便按数字排序? 1,2,3 ......
var teamMembers = Enumerable
.From(data)
.SelectMany("$.persons")
.SelectMany("$.periods")
.Where("$.teamName == '" + teamName + "'")
.OrderBy("$.periodName")
答案 0 :(得分:1)
试试这个
var teamMembers = Enumerable
.From(data)
.SelectMany("$.persons")
.SelectMany("$.periods")
.Where("$.teamName == '" + teamName + "'")
.OrderBy(function (x) { return parseInt(x.periodName); })
答案 1 :(得分:0)
var teamMembers = Enumerable
.From(data)
.SelectMany("$.persons")
.SelectMany("$.periods")
.Where("$.teamName == '" + teamName + "'")
.OrderBy(function (x) { return x.periodName; })
您必须确保订购号码。