search
HomeWeb Front-endJS TutorialAbout the background page development tutorial of uery EasyUI combined with ztrIee

Earlier we shared with you jQuery EasyUI combined with zTree tree structure to create web pages. Below, the editor will bring you an example of backend page development using JQuery EasyUI combined with ztree. The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor to take a look, I hope it can help everyone.

JQuery EasyUI combines zTree tree structure to create web pages. easyui is relatively simple to use. It encapsulates some functions of jquery very well and is more convenient to use. However, from version 1.2.3 onwards, commercial use is required Paid,

zTree is a jquery tree plug-in developed by domestic experts. It feels easy to use, very powerful, and completely free. The API is also very good. Recommended

easyui is a jQuery-based framework that integrates various user interface plug-ins.

easyui provides the necessary functionality to build modern interactive javascript applications.

Using easyui, you don’t need to write too much javascript code. Generally, you only need to use some html tags to define the user interface.

The complete framework of HTML web page.

easyui saves time and scale in product development.

easyui is very simple, but very powerful.

The following js files and style sheets need to be imported


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菜单设置
 var zTreeObj,
 setting = {
  view: {
   selectedMulti: false
  },
  // 添加编辑设置:修改树节点名称/删除树节点
  edit: {
   enable: true
  },
  data: { 
   simpleData: { 
    enable: true
   }
  },
  callback:{
   onClick: zTreeOnClick
  }
 };
 
 // 回调函数:单击事件
 function zTreeOnClick(event, treeId, treeNode, clickFlag) { 
  alert(treeNode.id + ", " + treeNode.name); 
  var content = &#39;<p style="width:100%;height:100% ;overflow:hidden;">&#39;
       +&#39;<iframe src="&#39;
       +treeNode.url
       +&#39;" scrolling="auto" style="width:100%;height:100%;border:0;"></iframe></p>&#39;;
  if(treeNode.url != undefined && treeNode.url != ""){
   // 当centre中是否存在名称为treeNode.name的tabs
   if($("#tt").tabs(&#39;exists&#39;,treeNode.name)){
    $("#tt").tabs(&#39;select&#39;,treeNode.name);
   }else {
    $("#tt").tabs(&#39;add&#39;,{
     title:treeNode.name,
     content:content,
     closable:true
    })
   }
  };
  event.preventDefault();
 };
 
 // 提供ztree树形菜单数据
 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":"父节点 2", "open":true},
        {"id":21,"pId":2, "name":"叶子节点 2-1"},
        {"id":22, "pId":2, "name":"叶子节点 2-2"},
        {"id":23,"pId":2, "name":"叶子节点 2-3"},
        {"id":3, "pId":0, "name":"父节点 3", "open":true},
        {"id":31, "pId":3, "name":"叶子节点 3-1"},
        {"id":32, "pId":3, "name":"叶子节点 3-2"},
        {"id":33, "pId":3, "name":"叶子节点 3-3"}
       ];
 
 // 3.生成树形菜单
 $(document).ready(function(){
  zTreeObj = $.fn.zTree.init($("#tree"), setting, zTreeNodes);
 });
 
 // 4.对象选项卡注册右击事件
 $(document).ready(function(){
  $("#tt").tabs({
   onContextMenu:function(e,title,index){
   // 阻止系统默认的右击事件
    e.preventDefault();
    $(&#39;#mm&#39;).menu(&#39;show&#39;, {
     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);
      // 当点击关闭当前选项卡时
      if(item.name===&#39;current&#39;){
       $(&#39;#tt&#39;).tabs(&#39;close&#39;,title);
      // 当点击关闭其他选项卡时
      }else if(item.name === &#39;others&#39;){
       var tabs = $(&#39;#tt&#39;).tabs(&#39;tabs&#39;);
       $(tabs).each(function(){
        if($(this).panel(&#39;options&#39;).title != &#39;消息中心&#39; && $(this).panel(&#39;options&#39;).title != title){
         $(&#39;#tt&#39;).tabs(&#39;close&#39;,$(this).panel(&#39;options&#39;).title);
        }
       });
      // 当点击关闭所有选项卡时
      }else if(item.name === &#39;all&#39;){
       var tabs = $(&#39;#tt&#39;).tabs(&#39;tabs&#39;);
       $(tabs).each(function(){
          if($(this).panel(&#39;options&#39;).title != &#39;消息中心&#39;){
         $(&#39;#tt&#39;).tabs(&#39;close&#39;,$(this).panel(&#39;options&#39;).title);
        }
       });
      }
     } 
    });
   }
  })
 }) 
</script>

The corresponding htm part code


<body class="easyui-layout">
 <p data-options="region:&#39;north&#39;,title:&#39;北丐:洪七公&#39;,split:true" style="height:100px;"></p>
 <p data-options="region:&#39;south&#39;,title:&#39;南帝:一灯大师&#39;,split:true" style="height:100px;"></p>
 <p data-options="region:&#39;east&#39;,iconCls:&#39;icon-reload&#39;,title:&#39;东邪:黄药师&#39;,split:true" style="width:100px;"></p>
 <p data-options="region:&#39;west&#39;,title:&#39;西毒:欧阳锋&#39;,split:true" style="width:250px;">
  <p id="aa" data-options="fit:&#39;true&#39;" class="easyui-accordion">
   <p title="赵敏" data-options="iconCls:&#39;icon-save&#39;" >
    <h3 id="Accordion-nbsp-for-nbsp-jQuery">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>
   </p>
   <p title="大玉儿" data-options="iconCls:&#39;icon-reload&#39;,selected:true" >
    // ztree属性结构
    <ul id="tree" class="ztree" style="width:230px; overflow:auto;"></ul>
   </p>
   <p title="婉容儿" >
    who?
   </p>
  </p>
 </p>
 <p data-options="region:&#39;center&#39;,title:&#39;中神通:周伯通&#39;">
  // tabs 面板
  <p id="tt" class="easyui-tabs" data-options="fit:true">
   <p title="小龙女"data-options="closable:true" ></p>
   <p title="沐剑屏" data-options="closable:true" ></p>
   <p title="阿珂" data-options="iconCls:&#39;icon-reload&#39;,closable:true"></p>
  </p>
 </p>
 
 // menu菜单栏
 <p id="mm" class="easyui-menu" style="width:120px;">
  <p name="current">关闭当前选项卡</p>
  <p name="others">关闭其他选项卡</p>
  <p class="menu-sep"></p>
  <p data-options="iconCls:&#39;icon-cancle&#39;" name="all">关闭所有选项卡</p>
 </p>
</body>

Related recommendations:

Example detailed explanation jQuery EasyUI combined with zTree tree structure to create a web page

zTree asynchronous loading and expansion First-level node method implementation

ztree implements dynamically generated tree on the left and content details function instance sharing on the right

The above is the detailed content of About the background page development tutorial of uery EasyUI combined with ztrIee. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
JavaScript Applications: From Front-End to Back-EndJavaScript Applications: From Front-End to Back-EndMay 04, 2025 am 12:12 AM

JavaScript can be used for front-end and back-end development. The front-end enhances the user experience through DOM operations, and the back-end handles server tasks through Node.js. 1. Front-end example: Change the content of the web page text. 2. Backend example: Create a Node.js server.

Python vs. JavaScript: Which Language Should You Learn?Python vs. JavaScript: Which Language Should You Learn?May 03, 2025 am 12:10 AM

Choosing Python or JavaScript should be based on career development, learning curve and ecosystem: 1) Career development: Python is suitable for data science and back-end development, while JavaScript is suitable for front-end and full-stack development. 2) Learning curve: Python syntax is concise and suitable for beginners; JavaScript syntax is flexible. 3) Ecosystem: Python has rich scientific computing libraries, and JavaScript has a powerful front-end framework.

JavaScript Frameworks: Powering Modern Web DevelopmentJavaScript Frameworks: Powering Modern Web DevelopmentMay 02, 2025 am 12:04 AM

The power of the JavaScript framework lies in simplifying development, improving user experience and application performance. When choosing a framework, consider: 1. Project size and complexity, 2. Team experience, 3. Ecosystem and community support.

The Relationship Between JavaScript, C  , and BrowsersThe Relationship Between JavaScript, C , and BrowsersMay 01, 2025 am 12:06 AM

Introduction I know you may find it strange, what exactly does JavaScript, C and browser have to do? They seem to be unrelated, but in fact, they play a very important role in modern web development. Today we will discuss the close connection between these three. Through this article, you will learn how JavaScript runs in the browser, the role of C in the browser engine, and how they work together to drive rendering and interaction of web pages. We all know the relationship between JavaScript and browser. JavaScript is the core language of front-end development. It runs directly in the browser, making web pages vivid and interesting. Have you ever wondered why JavaScr

Node.js Streams with TypeScriptNode.js Streams with TypeScriptApr 30, 2025 am 08:22 AM

Node.js excels at efficient I/O, largely thanks to streams. Streams process data incrementally, avoiding memory overload—ideal for large files, network tasks, and real-time applications. Combining streams with TypeScript's type safety creates a powe

Python vs. JavaScript: Performance and Efficiency ConsiderationsPython vs. JavaScript: Performance and Efficiency ConsiderationsApr 30, 2025 am 12:08 AM

The differences in performance and efficiency between Python and JavaScript are mainly reflected in: 1) As an interpreted language, Python runs slowly but has high development efficiency and is suitable for rapid prototype development; 2) JavaScript is limited to single thread in the browser, but multi-threading and asynchronous I/O can be used to improve performance in Node.js, and both have advantages in actual projects.

The Origins of JavaScript: Exploring Its Implementation LanguageThe Origins of JavaScript: Exploring Its Implementation LanguageApr 29, 2025 am 12:51 AM

JavaScript originated in 1995 and was created by Brandon Ike, and realized the language into C. 1.C language provides high performance and system-level programming capabilities for JavaScript. 2. JavaScript's memory management and performance optimization rely on C language. 3. The cross-platform feature of C language helps JavaScript run efficiently on different operating systems.

Behind the Scenes: What Language Powers JavaScript?Behind the Scenes: What Language Powers JavaScript?Apr 28, 2025 am 12:01 AM

JavaScript runs in browsers and Node.js environments and relies on the JavaScript engine to parse and execute code. 1) Generate abstract syntax tree (AST) in the parsing stage; 2) convert AST into bytecode or machine code in the compilation stage; 3) execute the compiled code in the execution stage.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use