一.tree控件的使用
$(function(){
//加载树
$('#myTree').tree({
url:ctx+'/loadModuleServlet.do',
onDblClick: function(node){
// alert(node.text); // 在用户点击的时候提示
//拿节点的子节点(后代)
var cs = $('#myTree').tree('getChildren',node.target);
if(cs.length==0){//如果没有后代
//判断是否存在
var f = $('#myTab').tabs('exists',node.text);
if(!f){//不存在就新建
//新建一个选项卡(Tab页) iconCls:'icon-mini-refresh'
$('#myTab').tabs('add',{
title:node.text, //标题
content:node.text, //内容
closable:true, //是否可关闭
iconCls:node.iconCls//图标
});
}
else{
//让对应选中
$('#myTab').tabs('select',node.text);
}
}
二.tabs控件的使用
<!--左侧tree树控件 -->
<ul id="myTree" class="easyui-tree">
</ul>
</div>
<div data-options="region:'center'" style="padding:5px;background:#fff;">
<!--中间选项卡Tab控件 -->
<div id="myTab" class="easyui-tabs" style="width:100%;height:100%;">
<div data-options="iconCls:'icon-application-osx-home'" title="首页" style="padding:10px;display:none;">
<img src="img/bz05.jpg" width="100%" height="100%">
</div>
三.easyui图标的使用
[{
"id":1,
"text":"My Documents",
"iconCls":"icon-folder-heart",
"children":[{
"id":11,
"text":"Photos",
"state":"closed",
"children":[{
"id":111,
"text":"Friend",
"iconCls":"icon-group-link"
},{
"id":112,
"text":"Wife",
"iconCls":"icon-user-female"
},{
"id":113,
"text":"Company",
"iconCls":"icon-flag-blue"
}]
},{
"id":12,
"text":"Program Files",
"children":[{
"id":121,
"text":"Intel"
},{
"id":122,
"text":"Java",
"attributes":{
"p1":"Custom Attribute1",
"p2":"Custom Attribute2"
}
},{
"id":123,
"text":"Microsoft Office"
},{
"id":124,
"text":"Games",
"checked":true
}]
},{
"id":13,
"text":"index.html"
},{
"id":14,
"text":"about.html"
},{
"id":15,
"text":"welcome.html"
}]
}]
√ 清除页面缓存
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">