//查找树节点
function findData(curOrg, id) {
var array = [];
if ((typeof curOrg == 'object') && (curOrg.constructor == Object.prototype.constructor)) {
array.push(curOrg);
}
else array = curOrg;
for (var i = 0; i < array.length; i++) {
var jn = array[i];
if (jn.OrgId == id) {
return jn;
}
if (jn.Orgs != "") {
return findData(jn.Orgs, id);
}
}
}
以下方法来自: http://www.cnblogs.com/sosoft/archive/2013/12/08/3463830.html
//数组去重
function unique(arr) {
var result = [], hash = {};
for (var i = 0, elem; (elem = arr[i]) != null; i++) {
if (!hash[elem]) {
result.push(elem);
hash[elem] = true;
}
}
return result;
}