CSS:
<!--jqGrid-->
<link rel="stylesheet" href="plugins/jqgird/css/ui.jqgrid.min.css"/>
DOM:
实例化的DOM元素必须是table <table id="treegrid2"></table> script:
<script src="plugins/jqgird/js/jquery.jqGrid.min.js"></script>
<script src="plugins/jqgird/js/grid.locale-zh.js"></script>
//当前页面脚本
<script type="text/javascript">
$(function(){
$(document).ready(function(){
var topicjson={
"response": [
{
"id": "1",
"Items": "Grouping",
"url":"www.baidu.com",
level:"0", parent:"", isLeaf:false, expanded:false, loaded:true
},
{
"id": "1_1",
"Items": "Simple Grouping",
"url":"www.baidu.com",
level:"1", parent:"1", isLeaf:true, expanded:false, loaded:true
},
{
"id": "1_2",
"Items": "May be some other grouping",
"url":"www.baidu.com",
level:"1", parent:"1", isLeaf:true, expanded:false, loaded:true
},
{
"id": "2",
"Items": "CustomFormater",
"url":"www.baidu.com",
level:"0", parent:"", isLeaf:false, expanded:false, loaded:false
},
{
"id": "2_1",
"Items": "Image Formatter",
"url":"www.baidu.com",
level:"1", parent:"2", isLeaf:false, expanded:false, loaded:false
}
,
{
"id": "2_1_1",
"Items": "Image Formatter",
"url":"www.baidu.com",
level:"2", parent:"2_1", isLeaf:true, expanded:false, loaded:false
},
{
"id": "2_1_2",
"Items": "Anchor Formatter",
"url":"www.baidu.com",
level:"2", parent:"2_1", isLeaf:true, expanded:false, loaded:false
} ,
{
"id": "2_2",
"Items": "Anchor Formatter",
"url":"www.baidu.com",
level:"1", parent:"2", isLeaf:true, expanded:false, loaded:true
} ]
},
grid;
$('<table id="list2"></table>').appendTo('#topics');
var lastsel;
grid = jQuery("#treegrid2");
grid.jqGrid({
datastr: topicjson,//数据源
datatype: "jsonstring",//数据类型
         //向后台请求数据
       //url: '/Department/Query/',
       //datatype: 'json',
     //mtype: 'GET',
                height: "auto",
width:"100%",
loadui: "enable",
colNames: ["id","Items","url"],
colModel: [
{name: "id",width:200, hidden:true, key:true},
{name: "Items", editable:true,width:250, resizable: false},
{name: "url",width:1, width:250, editable:true,hidden:false}
],
treeGrid: true,//启用girdTree
treeGridModel: "adjacency",//伸缩列模式
ExpandColumn: "Items", //伸缩列
ExpandColClick: true,
treeIcons: {plus:'ace-icon fa fa-caret-right bigger-160 blue',minus:'ace-icon fa fa-caret-down bigger-160 blue',leaf:'ace-icon fa fa-tags orange'},//树图标
caption: "jqGrid Demos",
autowidth: true,//宽度自适应
rowNum: 10000,
ExpandColClick: true,//列点击
jsonReader: {
repeatitems: false,
root: "response"
}
});
});
})
</script> <style type="text/css">
.tree-wrap.tree-wrap-ltr{
display: inline-block;
} .ui-icon.ui-icon-document-b.tree-leaf.treeclick{
position: relative;
} .ui-icon.treeclick.ui-icon-triangle-1-s.tree-minus{
position: relative;
} .ui-icon.treeclick.ui-icon-triangle-1-e.tree-plus{
position: relative;
}
</style>

jqGrid Tree的更多相关文章

  1. Web jquery表格组件 JQGrid 的使用 - 从入门到精通 开篇及索引

    因为内容比较多,所以每篇讲解一些内容,最后会放出全部代码,可以参考.操作中总会遇到各式各样的问题,个人对部分问题的研究在最后一篇 问题研究 里.欢迎大家探讨学习. 代码都经过个人测试,但仍可能有各种未 ...

  2. SSM+PageHelper+jqGrid实现数据分页

    前言 前几天自己写了一个分页功能,代码逻辑写的很乱今天发现jqGrid这个工具是真好用,故记录下来方便以后使用首先是PageHelper后台分页工具PageHelper的原理是基于拦截器实现的 具体流 ...

  3. 1. mvc 树形控件tree + 表格jqgrid 显示界面

    1.界面显示效果 2.资源下载 地址 1. jstree  https://www.jstree.com/   2.表格jqgrid  https://blog.mn886.net/jqGrid/  ...

  4. Web jquery表格组件 JQGrid 的使用 - 4.JQGrid参数、ColModel API、事件及方法

    系列索引 Web jquery表格组件 JQGrid 的使用 - 从入门到精通 开篇及索引 Web jquery表格组件 JQGrid 的使用 - 4.JQGrid参数.ColModel API.事件 ...

  5. jqGrid配置属性说明

    Property Type Description Default1) ajaxGridOptions object This option allows to set global ajax set ...

  6. jqGrid APi 详解

    jqGrid APi 详解 jqGrid皮肤 从3.5版本开始,jqGrid完全支持jquery UI的theme.我们可以从http://jqueryui.com/themeroller/下载我们所 ...

  7. Jqgrid学习API

    JQGrid是一个在jquery基础上做的一个表格控件,以ajax的方式和服务器端通信. JQGrid Demo 是一个在线的演示项目.在这里,可以知道jqgrid可以做什么事情. 下面是转自其他人b ...

  8. 【转】jqGrid 各种参数 详解

      [原文]http://www.cnblogs.com/younggun/archive/2012/08/27/2657922.htmljqGrid 各种参数 详解 JQGrid JQGrid是一个 ...

  9. 使用ztree.js,受益一生,十分钟学会使用tree树形结构插件

    看到ztree.js,这几个字眼,毋庸置疑,那肯定就是tree树形结构了,曾经的swing年代有jtree,后来jquery年代有jstree和treeview,虽然我没写过,但是我见过,一些小功能做 ...

随机推荐

  1. Codeforces Round #327 (Div. 2) E. Three States BFS

    E. Three States Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/591/probl ...

  2. windows command ftp 中文文件名乱码解决方法

    有时,使用临时的windows机子,要进行ftp简单操作,但又不想装其它的ftp-client,可以直接使用windows command中的命令ftp来操作. 通常,ftp服务器按标准,使用utf8 ...

  3. GitHub使用详解

    1.GitHub是什么? GitHub这个名词既可以是那个流行的代码分享和协作网站 https://github.com/,也可以是指Git客户端工具(与其他的Git客户端工具如GitEye类似,只不 ...

  4. 【ZZ】常用推荐算法

    http://liyonghui160com.iteye.com/blog/2082450 在推荐系统简介中,我们给出了推荐系统的一般框架.很明显,推荐方法是整个推荐系统中最核心.最关键的部分,很大程 ...

  5. C# TextBox 换行 滚动到最后一行

    .要让一个Windows Form的TextBox显示多行文本就得把它的Multiline属性设置为true. 这个大家都知道,可是当你要在代码中为Text属性设置多行文本的时候可能会遇到点麻烦:) ...

  6. jenkis编译报错:需要class,interface或enum

    现象: 1.jenkis编译报错:需要class,interface或enum 2.使用ant进行编译ok. 解决方法: 1. Jenkis重新编译一个以前成功的svn版本,直至编译成功. 2.Jen ...

  7. Spark之路 --- Scala用JFreeChart画图表实例

    JFreeChart介绍 JFreeChart是JAVA平台上的一个开放的图表绘制类库.它完全使用JAVA语言编写,是为applications, applets, servlets 以及JSP等使用 ...

  8. Linux 内核Coding Style整理

    转载:http://www.cnblogs.com/wang_yb/p/3532349.html 总结linux内核开发的coding style, 便于以后写代码时参考. 下面只是罗列一些规则, 具 ...

  9. myeclipse2014 安装maven3.3.9和mave配置本地仓库

    昨天晚上发现eclipse下一个aptana JS的编辑插件,就想装到myeclipse下,结果悲剧了,myeclipse每次启动都闪退,虽然最后解决了,但是myeclipse里面的自带插件不知少了好 ...

  10. C笔记01:关于printf函数输出先后顺序的讲解

    关于printf函数输出先后顺序的讲解!! 对于printf函数printf("%d%d\n", a, b);函数的实际输出顺序是这样的先计算出b,然后再计算a,接着输出a,最后再 ...