jquery插件treetable使用
2016-12-18 22:17
309 查看
下载后treetable插件后只需要保留jquery.treetable.css样式文件,jquery.treetable.theme.default.css皮肤文件和jquery.treetable.js库,在页面上引用后初始化
$("#treeTable").treetable({ expandable: true });
expandable为true ,初始化展开显示
先上局部视图改造后的代码,
之前同事写的嵌套几层循环,每层循环内判断,改造后在页面里定义输出方法递归调用,显示效果跟之前同事写的一样,看看效果
$("#treeTable").treetable({ expandable: true });
expandable为true ,初始化展开显示
先上局部视图改造后的代码,
@model List<Org> @helper RenderTable(Org org, List<Org> source) { <tr data-tt-id="@org.ID" data-tt-parent-id="@org.ParentID"> <td> <span class="folder">@org.Name</span>@((org.AreaType == 1) ? "(镜头组)" : "") </td> <td class="text-center"> <a href="#" onclick="edit(false,'@org.ID')"><span class="glyphicon glyphicon-edit"></span></a> @if (org.ParentID != "0" && source.Count(m => m.ParentID == org.ID) <= 0) { <a href="#" onclick="del('@org.ID','@org.Name')"><span class="glyphicon glyphicon-trash"></span></a> <i> </i> } @if (org.AreaType != 1) { <a href="#" onclick="edit(true,'@org.ID')"><span class="glyphicon glyphicon-plus"></span></a> } </td> </tr> if (source.Count(m => m.ParentID == org.ID) > 0) { foreach (var item in source.Where(m => m.ParentID == org.ID).ToList()) { @RenderTable(item, source); } } } <table class="table table-bordered table-striped" id="treeTable"> <thead> <tr> <th width="80%">编号</th> <th class="text-center">操作</th> </tr> </thead> <tbody> @if (null != Model && Model.Any()) { foreach (var item in Model.Where(m => m.ParentID == "0").ToList()) { @RenderTable(item, Model) } } </tbody> </table>
之前同事写的嵌套几层循环,每层循环内判断,改造后在页面里定义输出方法递归调用,显示效果跟之前同事写的一样,看看效果
相关文章推荐
- 使用组件来保护你的ASP代码
- SCI软件使用方法总结-定位测量篇
- IP 伪装简易使用说明
- 源码推荐:一个使用C#绘制图形引擎的Framework
- Win32汇编教程六 工具栏和状态栏的使用
- Win32汇编教程五 菜单和加速键的使用
- Win32汇编教程三 一个简单的对话框 --- 兼谈资源文件的使用
- 使用ActiveX控件开发网页常见的问题
- 使用 ASP+ DataGrid 控件来创建主视图/详细资料视图 (2)
- 使用 ASP+ DataGrid 控件来创建主视图/详细资料视图
- 手册中关于怎样使用TQuery 的误导
- 使用ASP和Word进行服务器端拼写检查
- 单独使用CRecordSet
- 在 Web 页上使用条件数值格式
- 关于PHP与Sybase数据库的连接与使用
- 使用ASP常见问题解答
- [导入]Guru of the Week:#41 使用标准库
- 如何使用ASP进行打印操作
- VB中Winsock控制的UDP协议的使用
- FUNCky 的使用