jquery利用sort方法对json数据排序
2021-01-27 04:16
标签:UNC cti col encode style var color 需要 inf 如果对FullName字段进行排序,只需要修改a.FullName-b.FullName即可。 jquery利用sort方法对json数据排序 标签:UNC cti col encode style var color 需要 inf 原文地址:https://www.cnblogs.com/firstcsharp/p/12848312.htmlvar jsonData = [{ModuleId: "cda2c478", EnCode: "work", FullName: "工务","Sort":2},{ModuleId: "8474a702", EnCode: "Setting", FullName: "设置", ,"Sort":1},{ModuleId: "76b37fcb", EnCode: "Emp", FullName: "成员",,"Sort":3}];
console.info("排序之前:" + jsonData);
jsonData.sort(function(a,b)
{
return a.Sort - b.Sort;
});
console.info("排序之后:" + jsonData);