jquery easyui菜单树显示

目前做了一个easyui项目需要显示多级菜单,菜单配置到数据库中,因此每级菜单都需要到数据库中取,用了jQueryEasyUI方便多了。效果体验:http://hovertree.com/texi

大家好,又见面了,我是全栈君,今天给大家准备了Idea注册码。

全栈程序员社区此处内容已经被作者隐藏,请输入验证码查看内容
验证码:
请关注本站微信公众号,回复“验证码”,获取验证码。在微信里搜索“全栈程序员社区”或者“www_javaforall_cn”或者微信扫描右侧二维码都可以关注本站微信公众号。

目前做了一个easyui项目需要显示多级菜单,菜单配置到数据库中,因此每级菜单都需要到数据库中取,用了jQuery EasyUI方便多了。

效果体验:http://hovertree.com/texiao/jeasyui/2/

下载:http://hovertree.com/h/bjaf/kbtdmn5u.htm

参考:http://hovertree.com/jeasyui/demo/tree/checkbox.html

http://hovertree.com/jeasyui/demo/tree/dnd.html

HTML代码:

 1 <!DOCTYPE html>
 2 <html>
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>树菜单操作 - jQuery EasyUI 范例 - 何问起</title><base target="_blank" />
 6     <link rel="stylesheet" type="text/css" href="http://hovertree.com/jeasyui/themes/default/easyui.css">
 7     <link rel="stylesheet" type="text/css" href="http://hovertree.com/jeasyui/themes/icon.css">
 8     <link rel="stylesheet" type="text/css" href="http://hovertree.com/jeasyui/demo/demo.css">
 9     <script type="text/javascript" src="http://hovertree.com/ziyuan/jquery/jquery-1.12.0.min.js"></script>
10     <script type="text/javascript" src="http://hovertree.com/jeasyui/jquery.easyui.min.js"></script>
11     <style>a{color:black;text-decoration:none;}</style>
12 </head>
13 <body>
14     <h2>树菜单操作</h2>
15     <p>点击下列按钮体验效果.</p>
16     <div style="margin:20px 0;">
17         <a href="javascript:;" class="easyui-linkbutton" onclick="collapseAll()" target="_self">全部收起</a>
18         <a href="javascript:;" class="easyui-linkbutton" onclick="expandAll()" target="_self">全部展开</a>
19         <a href="javascript:;" class="easyui-linkbutton" onclick="expandTo()" target="_self">展开选择指定项</a>
20         <a href="javascript:;" class="easyui-linkbutton" onclick="getSelected()" target="_self">获取选择项值</a>
21     </div>
22     <div class="easyui-panel" style="padding:5px">
23         <ul id="tt" class="easyui-tree" data-options="url:'tree_data1.json',method:'get',animate:true"></ul>
24     </div>
25     <br /><br />
26     <a href="http://hovertree.com/">首页</a>
27     <script type="text/javascript">
28         function collapseAll(){
29             $('#tt').tree('collapseAll');
30         }
31         function expandAll(){
32             $('#tt').tree('expandAll');
33         }
34         function expandTo(){
35             var node = $('#tt').tree('find',113);
36             $('#tt').tree('expandTo', node.target).tree('select', node.target);
37         }
38         function getSelected(){
39             var node = $('#tt').tree('getSelected');
40             if (node){
41                 var s = node.text;
42                 if (node.attributes){
43                     s += ","+node.attributes.p1+","+node.attributes.p2;
44                 }
45                 alert(s);
46             }
47         }
48     </script>
49 </body>
50 </html>

菜单项的json文件代码:

[
{
"id": 1,
"text": "Tree菜单",
"children": [
{
"id": 11,
"text": "Photos",
"state": "closed",
"children": [
{
"id": 111,
"text": "<a href='http://hovertree.com'>何问起</a>"
},
{
"id": 112,
"text": "<a href='http://hovertree.com/jeasyui/'>EasyUI</a>"
},
{
"id": 113,
"text": "<a href='http://hovertree.com/menu/jquery/'>jQuery</a>"
}
]
},
{
"id": 12,
"text": "Program Files",
"children": [
{
"id": 121,
"text": "<a href='http://hovertree.com/h/bjaf/hoverclock.htm'>HoverClock</a>"
},
{
"id": 122,
"text": "<a href='http://hovertree.com/h/bjaf/easysector.htm'>画饼图</a>",
"attributes": {
"p1": "Custom Attribute1",
"p2": "Custom Attribute2"
}
},
{
"id": 123,
"text": "<a href='http://hovertree.com/h/bjaf/hovertreebatch.htm'>批量重命名</a>"
},
{
"id": 124,
"text": "<a href='http://tool.hovertree.com/a/base64/'>图像转码</a>",
"checked": true
}
]
},
{
"id": 13,
"text": "<a href='http://hovertree.com/texiao/game/'>见缝插针</a>"
},
{
"id": 14,
"text": "<a href='http://hovertree.com/shortanswer/bjaf/j43wyyvr.htm'>选择题</a>"
},
{
"id": 15,
"text": "<a href='http://hovertree.com/h/bjaf/css3icon.htm'>图标</a>"
},
{
"id": 16,
"text": "<a href='http://hovertree.com/h/bjaf/treeaction.htm'>原文</a>"
}
]
}
]

更多特效:http://www.cnblogs.com/roucheng/p/texiao.html

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/120666.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • treeview控件使用详解python_TreeView控件实践

    treeview控件使用详解python_TreeView控件实践TreeView控件可以通过HierarchicalDataTemplate和DataTemplate来自定义。1)HierarchicalDataTemplate用来支持HeaderedItemsControl,其中DataType指定当前的数据类型,只有符合这个类型才使用HierarchicalDataTemplate;ItemsSource用来指定ItemsHost;内部的自定义实现(…

    2025年8月11日
    2
  • Qt中使用匿名函数lambda表达式

    Qt中使用匿名函数lambda表达式

    2021年11月20日
    33
  • 单片机中0x00什么意思_单片机中0x01什么意思

    单片机中0x00什么意思_单片机中0x01什么意思0x00=0,0×01=1,比如说P1=0x00,也就是给P1.0~P1.7端口赋低电平,P1=0x01,是P1.0为高电平,P1.1~P1.7为低电平.这是十六进制的表示方法,转换成二进制分别是:0x00=00000000;0x01=00000001,也就是单片机P口的八位P1.7~P1.0从低位到高位输出的电平。…

    2025年8月1日
    2
  • 微信上赚钱需要准备什么?[通俗易懂]

    微信上赚钱需要准备什么?[通俗易懂]微信上赚钱需要准备什么?1、一个风口上的产品2、微信好友人脉资源3、群发工具其实很多时候赚钱并没有那么难,想在微信上做生意、做社交其实很简单。很多人目前可能手头都有至少一个产品是可以卖的,但是他们没有有效的利用起来自己的微信人脉。也许是不会;也许是会,但是没工具不能;也许就是懒……不管出于什么原因,我这篇文章是写给想赚钱的人。加余老师VX:125381839微精灵营销工具可以帮助我们做哪些…

    2022年6月4日
    40
  • 产品经理面试题整理

    产品经理面试题整理凡事“预则立,不预则费”。即使你有丰富的产品经验,在面试那种紧张的环境下要面试好也不是一件易事,因为在那种环境下,你要对面试官提出的问题快速反映,快速组织语言,而你又没有经常训练这种能力,想回答好还是很不容易的,如果你经常背一些产品经理的面试题,那你回答的时候就流畅多了,下面将一些常见的产品经理面试题整理下来,需要的小伙伴拿去。下面我们先看看都有什么问题吧以下是上面的问题的具体解析,可能不全面,欢迎大家补充1、介绍一下你自己介绍一下自己的姓名,年龄、毕业院校,工作…

    2022年6月25日
    33
  • python中的取整

    python中的取整python中的取整

    2022年7月5日
    22

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号