前台  html:
<ul class="easyui-tree" id="ul_Tree" data-options="fit:true,animate:true"></ul> javascript 加载
$("#ul_Tree").tree({
url: '/webservice/CreditExtension/CreditExtension.asmx/QueryImages?Hid_FileCode=' + $("#Hid_FileCode").val() + "&imgstyle=0&r=" + new Date().getMilliseconds(),
method: 'get',
onSelect: function (note) {
if (note.attributes != undefined && note.attributes != "") {
var style = note.attributes.substr(note.attributes.lastIndexOf("."), note.attributes.length - note.attributes.lastIndexOf("."));
if (style == ".bmp" || style == ".gif" || style == ".jpg" || style == ".png" || style == ".jpeg") {
setTheFirst(note.attributes);
$("#img_show").attr("src", note.attributes);
$("#div_title").html(note.text);
} else { window.open(note.attributes, "preview", ""); }
}
else { $("#ul_Tree").tree("toggle", note.target); }
}
});
后台返回json:
public string GetToTreeJson(DataSet ds)
{
StringBuilder result = new StringBuilder();
result.Append("[");
foreach (DataRow dr in ds.Tables[0].Rows)
{
result.Append("{\"id\":0,\"text\":\"" + dr["text"].ToString() + "\",\"iconCls\":\"icon-hkb\"");
DataRow[] drs = ds.Tables[1].Select(" parent_id='" + dr["id"].ToString() + "'");
if (drs.Length > 0)
{
result.Append(",\"state\":\"closed\",\"children\":[");
for (int i = 0; i < drs.Length; i++)
{
if (i > 0) result.Append(",");
result.Append("{\"id\":" + drs[i]["id"].ToString() + ",\"text\":\"" + drs[i]["text"].ToString() + "\",\"attributes\":\"" + imgpath + formatString(drs[i]["attributes"].ToString()) + "\",\"iconCls\":\"icon-" + getStyle(drs[i]["attributes"]) + "\"}");
}
result.Append("]");
}
else
{
result.Append(",\"state\":\"open\"");
}
result.Append("},");
}
result.Remove(result.Length - 1, 1);
result.Append("]");
return result.toString();
}

  

Easyui 加载树(easyui-tree)[dotnet]的更多相关文章

  1. EasyUI加载树控件自动展开所有目录

    在这里如何加载树控件就不在熬述,在加载树控件后,树的节点全部展开,要在OnLoadSuccess事件中写代码:

  2. spring mvc easyui tree 异步加载树

    使用spring mvc 注解 异步加载一棵树 jsp: <ul id="orgInfoTree"></ul> $(function(){ loadOrgT ...

  3. easyui 加载本地json 文件的方法

    easyui 加载本地json 文件的方法 2017年12月15日 17:18:07 vivian_hnd 阅读数 2155 https://blog.csdn.net/vivian_wang07/a ...

  4. Extjs整体加载树节点

    Ext.onReady(function () {             Ext.define('company', {                 extend: 'Ext.data.Mode ...

  5. ligerui_ligerTree_003_配置url参数,加载“树”

    配置url参数,加载“树”: 源码下载地址:http://download.csdn.net/detail/poiuy1991719/8571255 效果图:json.txt HTML代码: < ...

  6. JQuery/JS插件 jsTree加载树,预先加载,初始化时加载前三级节点,当展开第三级节点时 就加载该节点下的所有子节点

    jsTree加载树, 初始化时 加载前三级节点, 当展开第三级节点时 就加载该节点下的所有子节点 html: <!DOCTYPE html> <html> <head&g ...

  7. EasyUI 加载Tree

    function LoadTree(result) { mainMenu = $('#mainMenu').tree({ url: "/ajax/GetTreeJson.ashx" ...

  8. easyui加载datagrid时随着窗体大小改变而改变

    function initTable() {     $('#tt').datagrid({         width: $(document).width() - 20,         heig ...

  9. ExtJS 创建动态加载树

    Ext 中导航树的创建有两种方式:1.首先将所有的数据读出来,然后绑定到前台页面.2.每点击一个节点展开后加载子节点.在数据量比较小的时候使用第一种方式加载的会快一些,然而当数据量比较大的时候,我还是 ...

随机推荐

  1. C语言signal处理的小例子

    [pgsql@localhost tst]$ cat sig01.c #include <stdio.h> #include <signal.h> static void tr ...

  2. SqlServer获取表结构语句

    --sql server 2005-- 1. 表结构信息查询 -- ================================================================== ...

  3. 很近没读书了,读书笔记之<<大道至简>>

    空闲时间不想虚度,不知道干啥的时候,就读读存在移动硬盘里的电子书吧,已经放了N久了,不知道什么时候放的,好像是大学刚毕业的时候下载的,...... 好久...... 现在才去读..是不是太晚了.... ...

  4. Codeforces Gym 100610 Problem E. Explicit Formula 水题

    Problem E. Explicit Formula Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/10 ...

  5. C#操作MySQL数据库-----HelloWorld

    这里采用在visual studio 2010中通过MySql.Data.dll.MySql.Web.dll来连接mysql数据库, 之后便进行数据的插入和查询. Program.cs文件内容如下: ...

  6. [Angular 2] Factory Provider with dependencies

    This lesson discusses when and how to add dependencies, resolved by Angular’s DI, to factory provide ...

  7. IOS 小技巧积累

    转自:http://blog.csdn.net/mars2639/article/details/7352012 1. 使用@property和@synthesize声明一个成员变量,给其赋值是时要在 ...

  8. 交换a、b

    有两个变量a和b,不使用任何中间变量交换a和b. 方法一: 采用如下方法: a=a+b; b=a-b; a=a-b; 这样做的缺点就是如果a.b都是比较大的数,则a=a+b时就会越界. 而采用: a= ...

  9. MDIO/MDC(SMI)接口

    转载:http://blog.chinaunix.net/uid-24148050-id-132863.html 1. 简介 The MDIO interface is a simple, two-w ...

  10. Roadblocks http://poj.org/problem?id=3255

    Description Bessie has moved to a small farm and sometimes enjoys returning to visit one of her best ...