spring mvc jquery esayui tree 使用备份

<script src="${ctx}/static/esayui/jquery.easyui.min.js" type="text/javascript"></script>
	<script type="text/javascript">  
    $(function(){
        $("#tt").tree({
        	url:'${ctx}/permission/getRegion',
        	checkbox:true,
        	method:'post',
        	animate:true,
        	cascadeCheck:true,
        	//loadFilter:function(data,parent){
        		//return convert(data);
        	//},
        	onClick:function(node){
        		
        		alert(node.id+"-"+node.text);
        		
        	},
        	onBeforeExpand:function(node){
        		return true;
        	},
        	onExpand:function(node){
         	  	var node = $('#tt').tree('find', '210');
         	  	$('#tt').tree('check', node.target);
        		return true;
        	}
        });
        //转换服务器返回的json为tree数据源
         function convert(rows){
        	   var nodes = [];
        	   for(var i=0; i<rows.length; i++){
        	   		var row = rows[i];
        	   		nodes.push({
        	   			id:row.id,
        	   			text:row.name,
        	   			state:row.state
					});
        	   }
        	  return nodes;
		}
        
   });
    //获取已选择的节点
    function getCheckedNoeds(){
    	var nodes = $('#tt').tree('getChecked');
		var reNodes =[];
		for (var i=0; i<nodes.length; i++){
			node =nodes[i];
			reNodes.push(node.id.toString());
		}
    	alert(typeof(reNodes));
    	return reNodes;
    }
    //设置节点状态为已选中状态
    function setNodeChecked(){
    	var node = $('#tt').tree('find', '086');
    	alert(node.id+'--'+node.text);
    	$('#tt').tree('check', node.target);

    }
    </script>

相关推荐