We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
一、 用如下伪码表示待排序的数组对象
var val1 = [ {对象0}, {对象1}, {对象2}, ……{对象n}]
二、其中每一个对象中都有很多键值,如下对象0中,属性和属性值如下:
三、需求
对var1这个数组进行排序,排序按照var1数组对象中的COL_INDEX这个字段进行。
四、实现
val1 = val1.sort(commonFn.sortByPro('COL_INDEX')); /* 公共函数类 class commonFn */ var commonFn = { //根据某个属性值进行排序,通过sort方法调用 arr.sort(sortByPro(pro)) sortByPro: function (pro) { return function(a,b){ var value1 = a[pro]; var value2 = b[pro]; return value1 - value2; }; } }
五、这里用到了js中数组对象的基础知识
The text was updated successfully, but these errors were encountered:
No branches or pull requests
一、 用如下伪码表示待排序的数组对象
var val1 = [ {对象0}, {对象1}, {对象2}, ……{对象n}]
二、其中每一个对象中都有很多键值,如下对象0中,属性和属性值如下:
三、需求
对var1这个数组进行排序,排序按照var1数组对象中的COL_INDEX这个字段进行。
四、实现
五、这里用到了js中数组对象的基础知识
The text was updated successfully, but these errors were encountered: