EasyUI combines zTree tree structure to create web pages
This time I will bring you EasyUI combined with zTree tree structure to create a web page. What are the precautions for EasyUI combined with zTree tree structure to create a web page. The following is a practical case. Let’s take a look. .
JQuery EasyUI combination zTree tree structure is used 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, starting from version 1.2.3, commercial use requires payment. zTree is a domestic leader. We made a jquery tree plug-in. It feels very easy to use, very powerful, and completely free. The API is also very good. Recommend
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 an HTML web page.
easyui saves time and scale in developing products.
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(This file includes core,exhide,exedit,excheck)
ztree/zTreeStyle.css
<script type="text/javascript"> // ztree菜单设置 varzTreeObj, setting = { view: { selectedMulti:false }, // 添加编辑设置:修改树节点名称/删除树节点 edit: { enable:true }, data: { simpleData: { enable:true } }, callback:{ onClick: zTreeOnClick } }; // 回调函数:单击事件 functionzTreeOnClick(event, treeId, treeNode, clickFlag) { alert(treeNode.id +", "+ treeNode.name); varcontent ='<p style="width:100%;height:100% ;overflow:hidden;">' +'<iframe src="' +treeNode.url +'" scrolling="auto" style="width:100%;height:100%;border:0;"></iframe></p>'; if(treeNode.url != undefined && treeNode.url !=""){ // 当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树形菜单数据 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(); $('#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); // 当点击关闭当前选项卡时 if(item.name==='current'){ $('#tt').tabs('close',title); // 当点击关闭其他选项卡时 }elseif(item.name ==='others'){ vartabs = $('#tt').tabs('tabs'); $(tabs).each(function(){ if($(this).panel('options').title !='消息中心'&& $(this).panel('options').title != title){ $('#tt').tabs('close',$(this).panel('options').title); } }); // 当点击关闭所有选项卡时 }elseif(item.name ==='all'){ vartabs = $('#tt').tabs('tabs'); $(tabs).each(function(){ if($(this).panel('options').title !='消息中心'){ $('#tt').tabs('close',$(this).panel('options').title); } }); } } }); } }) }) </script>
The corresponding htm part code
<bodyclass="easyui-layout"> <pdata-options="region:'north',title:'北丐:洪七公',split:true"style="height:100px;"></p> <pdata-options="region:'south',title:'南帝:一灯大师',split:true"style="height:100px;"></p> <pdata-options="region:'east',iconCls:'icon-reload',title:'东邪:黄药师',split:true"style="width:100px;"></p> <pdata-options="region:'west',title:'西毒:欧阳锋',split:true"style="width:250px;"> <pid="aa"data-options="fit:'true'"class="easyui-accordion"> <ptitle="赵敏"data-options="iconCls:'icon-save'"> <h3style="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> </p> <ptitle="大玉儿"data-options="iconCls:'icon-reload',selected:true"> // ztree属性结构 <ulid="tree"class="ztree"style="width:230px; overflow:auto;"></ul> </p> <ptitle="婉容儿"> who? </p> </p> </p> <pdata-options="region:'center',title:'中神通:周伯通'"> // tabs 面板 <pid="tt"class="easyui-tabs"data-options="fit:true"> <ptitle="小龙女"data-options="closable:true"></p> <ptitle="沐剑屏"data-options="closable:true"></p> <ptitle="阿珂"data-options="iconCls:'icon-reload',closable:true"></p> </p> </p> // menu菜单栏 <pid="mm"class="easyui-menu"style="width:120px;"> <pname="current">关闭当前选项卡</p> <pname="others">关闭其他选项卡</p> <pclass="menu-sep"></p> <pdata-options="iconCls:'icon-cancle'"name="all">关闭所有选项卡</p> </p> </body>
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the PHP Chinese website!
Recommended reading:
jQuery makes mouse wheel operation picture zoom size
How to use keyboard events in jquery
The above is the detailed content of EasyUI combines zTree tree structure to create web pages. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

easyui is a jquery plug-in. easyui is a front-end UI interface plug-in based on JQuery, which is used to help web developers more easily create feature-rich and beautiful UI interfaces. easyui is a framework that perfectly supports HTML5 web pages, which can help developers save the time and scale of web development.

Lambda expression is an anonymous function without a name, and its syntax is: (parameter_list)->expression. They feature anonymity, diversity, currying, and closure. In practical applications, Lambda expressions can be used to define functions concisely, such as the summation function sum_lambda=lambdax,y:x+y, and apply the map() function to the list to perform the summation operation.

The basic structure and technology of the internet originated from ARPANET. ARPANET is a milestone in the development of computer network technology. Its research results have played an important role in promoting the development of network technology and laid the foundation for the formation of the Internet. Arpanet (Arpanet) was the world's first operational packet switching network developed by the U.S. Defense Advanced Research Projects Agency. It is the ancestor of the global Internet.

The MySQL.proc table is a system table that stores stored procedure and function information in the MySQL database. By in-depth understanding of its structure and purpose, you can better understand the operating mechanism of stored procedures and functions in MySQL, and perform related management and optimization. The structure and purpose of the MySQL.proc table will be analyzed in detail below, and specific code examples will be provided. 1. The structure of the MySQL.proc table. The MySQL.proc table is a system table that stores the definitions and related information of all stored procedures and functions.

How to use HTML and CSS to implement a layout with a fixed navigation menu. In modern web design, fixed navigation menus are one of the common layouts. It can keep the navigation menu always at the top or side of the page, allowing users to browse web content conveniently. This article will introduce how to use HTML and CSS to implement a layout with a fixed navigation menu, and provide specific code examples. First, you need to create an HTML structure to present the content of the web page and the navigation menu. Here is a simple example

How to design the mall's evaluation table structure in MySQL? In a shopping mall system, evaluation is one of the most important functions. Evaluations can not only provide reference for other users, but also help merchants understand users’ feedback and opinions on products. Designing a reasonable evaluation form structure is crucial to the operation of the mall system and user experience. This article will introduce how to design the mall's evaluation table structure in MySQL and provide specific code examples. First, we need to create two basic tables: product table and user table. product list (product

There are four common flow control structures in Python, namely sequential structure, conditional structure, loop structure and jump structure. The following will introduce them one by one and provide corresponding code examples. Sequential structure: A sequential structure is a structure in which the program is executed in a predetermined order from top to bottom, without specific keywords or syntax. Sample code: print("This is the sequence structure example 1")print("This is the sequence structure example 2")print("This is the sequence structure example 2")

Title: Exploring the Internal Structure of the Linux File System The Linux operating system is famous for its stability and flexibility, and the file system, as one of its cores, plays a key role. An in-depth understanding of the internal structure of the Linux file system not only helps us understand the working principle of the operating system, but also helps us better manage and optimize the system. This article will explore the internal structure of the Linux file system with detailed code examples and explanations. 1. Introduction to file systems File systems are used by computers to organize and store files and to
