/**
 * 树型获取同一级的所有节点重新排序
 * id tree的id
 * targetNode DOM 对象,这个节点是被放置的目标
 * return 数组
 */
function TreeLevelNodeOrder(id,targetNode){
	var parent = $('#'+id).tree('getParent', targetNode);
	//获取同一级节点
	var nodeList = parent?$('#'+id).tree('getChildren',parent.target):$('#'+id).tree('getRoots');
	var orders = new Array();
	$.each(nodeList,function(i,val){
		orders[i] = nodeList[i].id;
	});
	return orders;
}

Post Navigation