标签:例子 list wan jason ack 行政区 fun data htm
语法:arraylist.sort(sortby);
sortby:排序函数;
例子:st=[{"ID":15,"trees":2,"NodeNM":" 省属","isLeaf":1,"haveData":null,"行政区划":"4290","项目类型":null},{"ID":14,"trees":2,"NodeNM":" 恩施土家族苗族自治州","isLeaf":1,"haveData":null,"行政区划":"4228","项目类型":null},{"ID":13,"trees":2,"NodeNM":" 随州市","isLeaf":1,"haveData":null,"行政区划":"4213","项目类型":null},{"ID":12,"trees":2,"NodeNM":" 咸宁市","isLeaf":1,"haveData":null,"行政区划":"4212","项目类型":null}];
function sortby(a,b)
{
return a.行政区划-b.行政区划
}
st.sort(sortby);
来源:https://www.cnblogs.com/jasonwang2y60/p/6656103.html
标签:例子 list wan jason ack 行政区 fun data htm
原文地址:https://www.cnblogs.com/yeyuqian/p/10394007.html