欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery EasyUI結(jié)合zTree樹形結(jié)構(gòu)制作web頁面

 更新時(shí)間:2017年09月01日 10:43:44   作者:mywifelidan  
這篇文章主要為大家詳細(xì)介紹了JQuery EasyUI 結(jié)合ztrIee的后臺(tái)頁面開發(fā),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

JQuery EasyUI 結(jié)合 zTree樹形結(jié)構(gòu)制作web頁面.easyui用起來比較簡單,很好的封裝了jquery的部分功能,使用起來更加方便,但是從1.2.3版本以后,商業(yè)用途是需要付費(fèi)的,zTree是國內(nèi)的大牛們搞的一個(gè)jquery樹形tree插件,感覺很好用,很強(qiáng)大,而且完全免費(fèi),API等做的也非常不錯(cuò).推薦

easyui 是一個(gè)基于 jQuery 的框架,集成了各種用戶界面插件。

easyui 提供建立現(xiàn)代化的具有交互性的 javascript 應(yīng)用的必要的功能。

使用 easyui,您不需要寫太多 javascript 代碼,一般情況下您只需要使用一些 html 標(biāo)記來定義用戶界面。

HTML 網(wǎng)頁的完整框架。

easyui 節(jié)省了開發(fā)產(chǎn)品的時(shí)間和規(guī)模。

easyui 非常簡單,但是功能非常強(qiáng)大。

需要的導(dǎo)入以下幾種js文件和樣式表

easyui/themes/default/easyui.css
easyui/themes/icon.css  
jquery-1.8.3.js
easyui/jquery.easyui.min.js
ztree/jquery.ztree.all-3.5.js(該文件包括core,exhide,exedit,excheck)
ztree/zTreeStyle.css

<script type="text/javascript">   
 // ztree菜單設(shè)置
 var zTreeObj,
 setting = {
  view: {
   selectedMulti: false
  },
  // 添加編輯設(shè)置:修改樹節(jié)點(diǎn)名稱/刪除樹節(jié)點(diǎn)
  edit: {
   enable: true
  },
  data: { 
   simpleData: { 
    enable: true
   }
  },
  callback:{
   onClick: zTreeOnClick
  }
 };
 
 // 回調(diào)函數(shù):單擊事件
 function zTreeOnClick(event, treeId, treeNode, clickFlag) { 
  alert(treeNode.id + ", " + treeNode.name); 
  var content = '<div style="width:100%;height:100% ;overflow:hidden;">'
       +'<iframe src="'
       +treeNode.url
       +'" scrolling="auto" style="width:100%;height:100%;border:0;"></iframe></div>';
  if(treeNode.url != undefined && treeNode.url != ""){
   // 當(dāng)centre中是否存在名稱為treeNode.name的tabs
   if($("#tt").tabs('exists',treeNode.name)){
    $("#tt").tabs('select',treeNode.name);
   }else {
    $("#tt").tabs('add',{
     title:treeNode.name,
     content:content,
     closable:true
    })
   }
  };
  event.preventDefault();
 };
 
 // 提供ztree樹形菜單數(shù)據(jù)
 zTreeNodes = [ {"id":1, "pId":0, "name":"海賊王"}, 
        {"id":11, "pId":1, "name":"娜美", "url":"http://man.linuxde.net/"}, 
        {"id":12, "pId":1, "name":"羅賓", "url":"http://www.baidu.com"},
        {"id":13, "pId":1, "name":"漢庫克", "url":"http://www.google.cn/"},
        { "id":2, "pId":0, "name":"父節(jié)點(diǎn) 2", "open":true},
        {"id":21,"pId":2, "name":"葉子節(jié)點(diǎn) 2-1"},
        {"id":22, "pId":2, "name":"葉子節(jié)點(diǎn) 2-2"},
        {"id":23,"pId":2, "name":"葉子節(jié)點(diǎn) 2-3"},
        {"id":3, "pId":0, "name":"父節(jié)點(diǎn) 3", "open":true},
        {"id":31, "pId":3, "name":"葉子節(jié)點(diǎn) 3-1"},
        {"id":32, "pId":3, "name":"葉子節(jié)點(diǎn) 3-2"},
        {"id":33, "pId":3, "name":"葉子節(jié)點(diǎn) 3-3"}
       ];
 
 // 3.生成樹形菜單
 $(document).ready(function(){
  zTreeObj = $.fn.zTree.init($("#tree"), setting, zTreeNodes);
 });
 
 // 4.對象選項(xiàng)卡注冊右擊事件
 $(document).ready(function(){
  $("#tt").tabs({
   onContextMenu:function(e,title,index){
   // 阻止系統(tǒng)默認(rèn)的右擊事件
    e.preventDefault();
    $('#mm').menu('show', {
     left: e.pageX,
     top: e.pageY
    }); 
   }
  });
 });
 
 // 獲取所選取的面板對象
 $(document).ready(function(){
  $("#tt").tabs({
   // 獲取所選取的面板對象
   onSelect : function(title,index ){
    // 5. menu的單擊事件綁定
    $("#mm").menu({ 
     onClick:function(item){ 
      alert(item.name);
      // 當(dāng)點(diǎn)擊關(guān)閉當(dāng)前選項(xiàng)卡時(shí)
      if(item.name==='current'){
       $('#tt').tabs('close',title);
      // 當(dāng)點(diǎn)擊關(guān)閉其他選項(xiàng)卡時(shí)
      }else if(item.name === 'others'){
       var tabs = $('#tt').tabs('tabs');
       $(tabs).each(function(){
        if($(this).panel('options').title != '消息中心' && $(this).panel('options').title != title){
         $('#tt').tabs('close',$(this).panel('options').title);
        }
       });
      // 當(dāng)點(diǎn)擊關(guān)閉所有選項(xiàng)卡時(shí)
      }else if(item.name === 'all'){
       var tabs = $('#tt').tabs('tabs');
       $(tabs).each(function(){
          if($(this).panel('options').title != '消息中心'){
         $('#tt').tabs('close',$(this).panel('options').title);
        }
       });
      }
     } 
    });
   }
  })
 }) 
</script> 

 相應(yīng)的htm 部分代碼

<body class="easyui-layout">
 <div data-options="region:'north',title:'北丐:洪七公',split:true" style="height:100px;"></div>
 <div data-options="region:'south',title:'南帝:一燈大師',split:true" style="height:100px;"></div>
 <div data-options="region:'east',iconCls:'icon-reload',title:'東邪:黃藥師',split:true" style="width:100px;"></div>
 <div data-options="region:'west',title:'西毒:歐陽鋒',split:true" style="width:250px;">
  <div id="aa" data-options="fit:'true'" class="easyui-accordion">
   <div title="趙敏" data-options="iconCls:'icon-save'" >
    <h3 style="color:#0099FF;">Accordion for jQuery</h3>
    <p>Accordion is a part of easyui framework for jQuery. It lets you define your accordion component on web page more easily.</p>
   </div>
   <div title="大玉兒" data-options="iconCls:'icon-reload',selected:true" >
    // ztree屬性結(jié)構(gòu)
    <ul id="tree" class="ztree" style="width:230px; overflow:auto;"></ul>
   </div>
   <div title="婉容兒" >
    who?
   </div>
  </div>
 </div>
 <div data-options="region:'center',title:'中神通:周伯通'">
  // tabs 面板
  <div id="tt" class="easyui-tabs" data-options="fit:true">
   <div title="小龍女"data-options="closable:true" ></div>
   <div title="沐劍屏" data-options="closable:true" ></div>
   <div title="阿珂" data-options="iconCls:'icon-reload',closable:true"></div>
  </div>
 </div>
 
 // menu菜單欄
 <div id="mm" class="easyui-menu" style="width:120px;">
  <div name="current">關(guān)閉當(dāng)前選項(xiàng)卡</div>
  <div name="others">關(guān)閉其他選項(xiàng)卡</div>
  <div class="menu-sep"></div>
  <div data-options="iconCls:'icon-cancle'" name="all">關(guān)閉所有選項(xiàng)卡</div>
 </div>
</body>

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論