easyui(tree前端工作)

一.思维导图

二.树 tree 的概念:

属性:
id:
text:
state:"open"/"closed"
iconCls:'icon-user-home'
children:[子节点]
数据来自json
父节点
子节点

判断其是不是子节点 getChildren .length 后代

三、选项卡 tabs

判断其是否存在 exists 存在就让其选中 select 不存在就新增一个

 代码展示:

%@include file="common/head.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css" />
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />

<script type="text/javascript">
    $(function() {
        $('#myTree').tree({
            url : ctx+'/s.do', //请求地址
            //animate:true;//定义节点在展开或折叠的时候是否显示动画效果。
            onDblClick : function(node) {
                //alert(node.text+" "+node.id+" "+node.state);  // 在用户双击的时候提示
                //拿到对应树节点集合
                var cs = $('#myTree').tree('getChildren',node.target);    
                if(cs.length==0){
                
                //判断是否存在
                var f = $('#myTab').tabs('exists',node.text);
                if(!f){//说明不存在
                    //新打开一个选项卡tap页    iconCls
                    $('#myTab').tabs('add',{    
                        title:node.text,    //标题    iframe内嵌套
                        content:'<iframe scrolling="no" frameborder="0" width="99%" height="99%" src="'+node.url+'"></iframe>',    //内容
                        closable:true,    //是否可关闭
                        iconCls:node.iconCls
                    }); 
                    
                }
                else{//说明存在 让其对应存在
                    $('#myTab').tabs('select',node.text);
                }
                    
                }
                
            }

        });
    })
</script>
</head>
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值