<!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. scala2.10.x case classes cannot have more than 22 parameters

    问题 这个错误出现在case class参数超出22个的时候. case classes cannot have more than 22 parameters 在scala 2.11.x版本以下时c ...

  2. drds 分库表的创建速记

    关键词 :dbpartition by hash(`INVESTOR_APPLY_ID`) 格式 :dbpartition by hash(分库字段) 创建例子: CREATE TABLE `BB_J ...

  3. FRM-92101解决办法

    /u02/UAT/inst/apps/UAT_newerp3/logs/ora/10.1.3/opmn/forms_default_group_1/ http://blog.csdn.net/orth ...

  4. struts拦截器

    struts中的拦截器相当于过滤器的作用 一在struts.xml中配置拦截器或拦截器栈 <interceptors>!--全部的拦截器 <interceptor name=&quo ...

  5. 夺命雷公狗---node.js---16之项目的构建在node+express+mongo的博客项目1

    废话不多说我们直接开工... 直接在目录下打开黑窗口: 然后就开始看看我们创建出来的文件了: 然后就开始创建项目下的目录了: 从这里就可以清晰的看得到我们的目录都是以前后台来分离开来的,引入模版也很简 ...

  6. 夺命雷公狗---Thinkphp----10之后台登录.注销一条龙

    首先我们还是还是写一个控制器名字叫LoginController.class.php的控制器,首先来写一个code的方法来让验证码先显示出来: public function Code(){ //创建 ...

  7. js中把JSON字符串转换成JSON对象最好的方法

    在JS中将JSON的字符串解析成JSON数据格式,一般有两种方式: 1.一种为使用eval()函数. 2. 使用Function对象来进行返回解析. 第一种解析方式:使用eval函数来解析,并且使用j ...

  8. Ajax错误 “SCRIPT7002: XMLHttpRequest: 网络错误 0x2ef3, 由于出现错误 00002ef3 而导致此项操作无法完成” 的归纳总结

    最近在做Asp.net项目的时候,用Ajax访问服务器数据有时候老是莫名其妙的报错:SCRIPT7002: XMLHttpRequest: 网络错误 0x2ef3, 由于出现错误 00002ef3 而 ...

  9. android 项目学习随笔二(引导页 )

    1.引导页 1.定义灰色.红色圆点的shape XML文件 2.定义布局文件,利用相对布局文件定位,利用线性布局加载灰色圆点,imageview加载红色圆点 3.android.support.v4. ...

  10. TM1680的I2C的51例程

    搞到一个例程,虽然是51的, 但是我的ST版本也是用的模拟I2C, 分析一下吧: unsigned char i=0;TM1680start();  //I2C起始信号 TM1680SendByte( ...