<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ComboTree - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="http://www.zi-han.net/case/easyui/jquery-easyui-1.3.1/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="http://www.zi-han.net/case/easyui/jquery-easyui-1.3.1/themes/icon.css">
<link rel="stylesheet" type="text/css" href="http://www.zi-han.net/case/easyui/jquery-easyui-1.3.1/demo/demo.css">
<script type="text/javascript" src="http://www.zi-han.net/case/easyui/jquery-easyui-1.3.1/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="http://www.zi-han.net/case/easyui/jquery-easyui-1.3.1/jquery.easyui.min.js"></script>
<script>

$.fn.tree.defaults.loadFilter = function (data, parent) {
var opt = $(this).data().tree.options;
var idField, textField, parentField;
if (opt.parentField) {
idField = opt.idField || 'id';
textField = opt.textField || 'text';
parentField = opt.parentField;
var i, l, treeData = [], tmpMap = [];
for (i = 0, l = data.length; i < l; i++) {
tmpMap[data[i][idField]] = data[i];
}
for (i = 0, l = data.length; i < l; i++) {
if (tmpMap[data[i][parentField]] && data[i][idField] != data[i][parentField]) {
if (!tmpMap[data[i][parentField]]['children'])
tmpMap[data[i][parentField]]['children'] = [];
data[i]['text'] = data[i][textField];
tmpMap[data[i][parentField]]['children'].push(data[i]);
} else {
data[i]['text'] = data[i][textField];
treeData.push(data[i]);
}
}
return treeData;
}
return data;
};

$.fn.combotree.defaults.loadFilter = $.fn.tree.defaults.loadFilter;
$(function(){
var jsonstr="[{'uid':null,'pageUtil':null,'id':1,'createDate':1415779364000,'modifyDate':1458544814000,'code':'Y001','name':'衣服','sortNo':0,'pid':0,'del':false,'note':'2','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':2,'createDate':1415779377000,'modifyDate':1415779377000,'code':'K001','name':'裤子','sortNo':0,'pid':0,'del':false,'note':'','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':3,'createDate':1415779390000,'modifyDate':1465981587000,'code':'Y0011','name':'袜子','sortNo':0,'pid':83,'del':false,'note':'','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':4,'createDate':1415779418000,'modifyDate':1420352406000,'code':'Y0022','name':'袄子塔顶','sortNo':0,'pid':83,'del':false,'note':'','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':5,'createDate':1415779429000,'modifyDate':1415779429000,'code':'Y0033','name':'运动衣','sortNo':0,'pid':83,'del':false,'note':'','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':6,'createDate':1415779455000,'modifyDate':1421036172000,'code':'FADSFDSAFADSFDASFADSFADS','name':'运动鞋FASDFADSFADSFADSFADS','sortNo':0,'pid':0,'del':false,'note':'FADSFADSFADSFADSFADSFDAS','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':7,'createDate':1415779513000,'modifyDate':1415779513000,'code':'ERKE','name':'品牌','sortNo':0,'pid':89,'del':false,'note':'','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':97,'createDate':1416411552000,'modifyDate':1419414704000,'code':'KGCZ','name':'开关插座','sortNo':0,'pid':0,'del':false,'note':'','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':98,'createDate':1416411574000,'modifyDate':1416411574000,'code':'KGCZ01','name':'86型','sortNo':0,'pid':8,'del':false,'note':'','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':99,'createDate':1416411593000,'modifyDate':1419399630000,'code':'KGCZ02','name':'118型','sortNo':0,'pid':8,'del':false,'note':'','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':100,'createDate':1416411975000,'modifyDate':1416411975000,'code':'DLQ','name':'断路器','sortNo':0,'pid':0,'del':false,'note':'','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':105,'createDate':1419236882000,'modifyDate':1419236882000,'code':'01','name':'电器','sortNo':0,'pid':0,'del':false,'note':'105','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':106,'createDate':1419236940000,'modifyDate':1419236940000,'code':'0101','name':'空调','sortNo':0,'pid':105,'del':false,'note':'106','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':107,'createDate':1419236954000,'modifyDate':1419236954000,'code':'0102','name':'冰箱','sortNo':0,'pid':105,'del':false,'note':'','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':110,'createDate':1419237269000,'modifyDate':1419237269000,'code':'0101','name':'手机','sortNo':0,'pid':105,'del':false,'note':'','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':111,'createDate':1419237294000,'modifyDate':1419237294000,'code':'010102','name':'触摸屏','sortNo':0,'pid':110,'del':false,'note':'','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':112,'createDate':1419237353000,'modifyDate':1419237353000,'code':'01','name':'电器','sortNo':0,'pid':0,'del':false,'note':'','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':115,'createDate':1419237560000,'modifyDate':1419402451000,'code':'0123','name':'电器123','sortNo':0,'pid':0,'del':false,'note':'21','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':116,'createDate':1419237574000,'modifyDate':1419237574000,'code':'0101','name':'3c','sortNo':0,'pid':105,'del':false,'note':'','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':117,'createDate':1419237585000,'modifyDate':1419237585000,'code':'010101','name':'手机','sortNo':0,'pid':116,'del':false,'note':'','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':168,'createDate':1419404597000,'modifyDate':1419404597000,'code':'ASZASZX','name':'ASDSAZX','sortNo':0,'pid':98,'del':false,'note':'XZC','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':176,'createDate':1422414566000,'modifyDate':1422414566000,'code':'1111','name':'111','sortNo':0,'pid':6,'del':false,'note':'11111','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':198,'createDate':1436841555000,'modifyDate':1437446373000,'code':'05000076','name':'猫爪鞋','sortNo':0,'pid':0,'del':false,'note':'丹诗戈','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':203,'createDate':1437533651000,'modifyDate':1437533651000,'code':'11000016','name':'舞蹈鞋','sortNo':0,'pid':0,'del':false,'note':'三沙','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':204,'createDate':1437534200000,'modifyDate':1437534200000,'code':'11000088','name':'足尖鞋','sortNo':0,'pid':0,'del':false,'note':'三沙','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':205,'createDate':1437534813000,'modifyDate':1437534813000,'code':'05000137','name':'连体服','sortNo':0,'pid':0,'del':false,'note':'丹诗戈','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':206,'createDate':1438167068000,'modifyDate':1438582999000,'code':'20','name':'服装','sortNo':0,'pid':1,'del':false,'note':'必迈','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':207,'createDate':1438582798000,'modifyDate':1438582798000,'code':'10','name':'鞋','sortNo':0,'pid':0,'del':false,'note':'必迈','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':208,'createDate':1438583023000,'modifyDate':1438583023000,'code':'30','name':'器配','sortNo':0,'pid':0,'del':false,'note':'必迈','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':209,'createDate':1442805522000,'modifyDate':1442805522000,'code':'11','name':'11','sortNo':0,'pid':5,'del':false,'note':'11','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':210,'createDate':1442807735000,'modifyDate':1442807735000,'code':'ww','name':'ww','sortNo':0,'pid':206,'del':false,'note':'ww','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':211,'createDate':1442975848000,'modifyDate':1442975848000,'code':'02','name':'电视','sortNo':0,'pid':105,'del':false,'note':'02','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':212,'createDate':1442975923000,'modifyDate':1442975923000,'code':'02012','name':'液晶电视','sortNo':0,'pid':211,'del':false,'note':'液晶电视','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':213,'createDate':1442997714000,'modifyDate':1442997816000,'code':'d002','name':'短裤','sortNo':0,'pid':2,'del':false,'note':'ddd','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':214,'createDate':1442997854000,'modifyDate':1442997854000,'code':'m001','name':'毛衣','sortNo':0,'pid':206,'del':false,'note':'mm','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':215,'createDate':1445411610000,'modifyDate':1445411610000,'code':'cj','name':'厨具','sortNo':0,'pid':0,'del':false,'note':'','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':216,'createDate':1445954594000,'modifyDate':1445954594000,'code':'C','name':'上衣','sortNo':0,'pid':0,'del':false,'note':null,'_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':217,'createDate':1445954594000,'modifyDate':1445954594000,'code':'B','name':'短裙','sortNo':0,'pid':0,'del':false,'note':null,'_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':218,'createDate':1467710253000,'modifyDate':1467710253000,'code':'333333333','name':'11111111','sortNo':0,'pid':0,'del':false,'note':'3333333333','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':219,'createDate':1467710909000,'modifyDate':1467710909000,'code':'111','name':'按时发大厦的法定是','sortNo':0,'pid':211,'del':false,'note':'111','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':220,'createDate':1467712667000,'modifyDate':1467712667000,'code':'3333','name':'33333','sortNo':0,'pid':5,'del':false,'note':'3333','_parentId':0,'state':null,'children':null,'parent':false},{'uid':null,'pageUtil':null,'id':221,'createDate':1467712764000,'modifyDate':1467712764000,'code':'11111','name':'111111','sortNo':0,'pid':220,'del':false,'note':'111111','_parentId':0,'state':null,'children':null,'parent':false}]";
var json=eval('(' + jsonstr + ')');
$("#cc").combotree({
idField: 'id',
textField: 'name',
required: false,
parentField: 'pid',
data:json
});

});
</script>
<style>
*{
font-size:12px;
}
body {
font-family:helvetica,tahoma,verdana,sans-serif;
padding:20px;
font-size:13px;
margin:0;
}
h2 {
font-size:18px;
color:#333;
font-weight:bold;
margin:0;
margin-bottom:15px;
}
.demo-info{
background:#FFFEE6;
color:#8F5700;
padding:12px;
}
.demo-tip{
width:24px;
height:16px;
float:left;
}

</style>
</head>
<body>

<input id="cc" name="cc" style="width:200px;">
</body>
</html>

combotree的加载方法的更多相关文章

  1. xib文件的加载方法

    xib文件的加载方法 以UITableViewCell的cell为例 很多时候因为系统的cell无法满足我们的日常需求,我们都会自定义cell 因为cell的界面比较固定,所以通常都会选择用xib来描 ...

  2. LIB库加载方法-引用百度百科

    LIB库加载方法,有三种,如下: 1.LIB文件直接加入到工程文件列表中 在VC中打开File View一页,选中工程名,单击鼠标右键,然后选中\"Add Files to Project\ ...

  3. jquery ajax局部加载方法介绍

    [导读] 在jquery中实现ajax加载的方法有很多种,不像以前的js的ajax只有那一种,下面我们介绍jquery ajax实现局部加载方法总结,有需要了解的朋友可参考.例 代码如下复制代码 $ ...

  4. javascript文件加载模式与加载方法

    加载方式 形象图像化方法,见 http://www.growingwiththeweb.com/2014/02/async-vs-defer-attributes.html 1. script标签, ...

  5. js不需要知道图片宽高的懒加载方法(经过实际测试,不加宽高仍然是无法正常加载的,设置height:auto,height:100%,仍然显示高度为0)

    js不需要知道图片宽高的懒加载方法 懒加载是如何实现的? - 简书https://www.jianshu.com/p/e86c61468285找到一个不需要知道图片宽高的懒加载方法了(经过实际测试,不 ...

  6. iOS UI-(多)视图控制器的生命周期、加载方法和模态视图方法以及屌丝方法

    #import "ViewController.h" #import "SecondViewController.h" @interface ViewContr ...

  7. UIImage加载图片的方式以及Images.xcassets对于加载方法的影响

    UIImage加载图片的方式以及Images.xcassets对于加载方法的影响 图片缓存 根据是否将创建好的对象缓存入系统内存,有两类创建UIImage对象的方法可选: 缓存:+ imageName ...

  8. iOS控制器与视图加载方法

    转载记录, 请看原文: 1. iOS中的各种加载方法(initWithNibName,loadNibNamed,initWithCoder,awakeFromNib等等)简单使用   http://w ...

  9. react路由按需加载方法

    使用router4之后以前的按需加载方法require.ensure 是不好使了. 所以我们改用react-loadable插件做按需加载. 第一步: yarn add react-loadable ...

随机推荐

  1. something about css locating.

    CSS position:static:默认属性,静态定位relative:相对定位,相对于父元素的定位,需要配合top,left,right,bottom,z-index等属性absolute:绝对 ...

  2. [原创]java WEB学习笔记85:Hibernate学习之路-- -映射 一对一关系 ,基于主键方式实现

    本博客的目的:①总结自己的学习过程,相当于学习笔记 ②将自己的经验分享给大家,相互学习,互相交流,不可商用 内容难免出现问题,欢迎指正,交流,探讨,可以留言,也可以通过以下方式联系. 本人互联网技术爱 ...

  3. Java基础(47):插入排序的Java封装(含原理,可运行,哨兵位的理解见VisualGo上面的动态分析)

    直接插入排序(Straight Insertion Sorting)的基本思想:在要排序的一组数中,假设前面(n-1) [n>=2] 个数已经是排好顺序的,现在要把第n个数插到前面的有序数中,使 ...

  4. C#访问PostGreSQL数据库的方法 http://www.jb51.net/article/35643.htm

    这次的项目中的一个环节要求我把PostGreSQL数据取出来,然后放到SqlServer里,再去处理分析. http://www.jb51.net/article/35643.htm - 我对Post ...

  5. java mybatis XML文件中大于号小于号转义

    因为这个是xml文件不允许出现类似“>”这样的字符 用了转义字符把>和<替换掉,然后就没有问题了. <=   相当于 <= >=  相当于 >= XML转义字 ...

  6. 【bs4】安装beautifulsoup

    Debian/Ubuntu,install $ apt-get install python-bs4 easy_install/pip $ easy_install beautifulsoup4 $ ...

  7. linux系统中grub配置文件

    安装了Windows和Linux时肯定要通过GRUB进行引导,GRUB引导器的主配置文件路径/boot/grub/grub.conf(也可能是/boot/grub2/grub.conf),以#号开头的 ...

  8. SQL数据库之变量

    --学习SQL数据库,变量是必须要掌握的概念,系统变量就是变量中最重要的变量之一,下面是SQL中系统变量的应用实例 use AdventureWorksDW exec sp_addtype 'char ...

  9. django templates学习使用记录

    可以在基本模板中多插入几个black来适应不同的布局

  10. java总结第三次//类和对象2、3

    四.类和对象2 主要内容:Java类的继承.方法的重写.覆盖.访问控制.super 关键字.多态性及其应用 1.继承 要求:Java只支持单继承,不允许多重继承 一个子类只能有一个父类 一个父类可以派 ...