jqGrid Tree
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的更多相关文章
- Web jquery表格组件 JQGrid 的使用 - 从入门到精通 开篇及索引
因为内容比较多,所以每篇讲解一些内容,最后会放出全部代码,可以参考.操作中总会遇到各式各样的问题,个人对部分问题的研究在最后一篇 问题研究 里.欢迎大家探讨学习. 代码都经过个人测试,但仍可能有各种未 ...
- SSM+PageHelper+jqGrid实现数据分页
前言 前几天自己写了一个分页功能,代码逻辑写的很乱今天发现jqGrid这个工具是真好用,故记录下来方便以后使用首先是PageHelper后台分页工具PageHelper的原理是基于拦截器实现的 具体流 ...
- 1. mvc 树形控件tree + 表格jqgrid 显示界面
1.界面显示效果 2.资源下载 地址 1. jstree https://www.jstree.com/ 2.表格jqgrid https://blog.mn886.net/jqGrid/ ...
- Web jquery表格组件 JQGrid 的使用 - 4.JQGrid参数、ColModel API、事件及方法
系列索引 Web jquery表格组件 JQGrid 的使用 - 从入门到精通 开篇及索引 Web jquery表格组件 JQGrid 的使用 - 4.JQGrid参数.ColModel API.事件 ...
- jqGrid配置属性说明
Property Type Description Default1) ajaxGridOptions object This option allows to set global ajax set ...
- jqGrid APi 详解
jqGrid APi 详解 jqGrid皮肤 从3.5版本开始,jqGrid完全支持jquery UI的theme.我们可以从http://jqueryui.com/themeroller/下载我们所 ...
- Jqgrid学习API
JQGrid是一个在jquery基础上做的一个表格控件,以ajax的方式和服务器端通信. JQGrid Demo 是一个在线的演示项目.在这里,可以知道jqgrid可以做什么事情. 下面是转自其他人b ...
- 【转】jqGrid 各种参数 详解
[原文]http://www.cnblogs.com/younggun/archive/2012/08/27/2657922.htmljqGrid 各种参数 详解 JQGrid JQGrid是一个 ...
- 使用ztree.js,受益一生,十分钟学会使用tree树形结构插件
看到ztree.js,这几个字眼,毋庸置疑,那肯定就是tree树形结构了,曾经的swing年代有jtree,后来jquery年代有jstree和treeview,虽然我没写过,但是我见过,一些小功能做 ...
随机推荐
- SAP-设置显示表格格式
在我们用SAP系统的过程中产看表格的时候,需要设置查看表格的格式,表格的格式主要包含两个方面: 1,表格的样式 在查看表格的时候点击[设置]-[用户参数] 勾选[ALV Grid display]就控 ...
- IOS Note - Outlet(插座) & Action(动作)
OutletActionViewController.h #import <UIKit/UIKit.h> @interface OutletActionViewController : U ...
- Codeforces Round #313 (Div. 2) B. Gerald is into Art 水题
B. Gerald is into Art Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/560 ...
- struts2源代码学习之初始化(一)
看struts2源代码已有一段时日,从今天開始,就做一个总结吧. 首先,先看看怎么调试struts2源代码吧,主要是下面步骤: 使用Myeclipse创建一个webproject 导入struts2须 ...
- 1039. Course List for Student (25)
题目链接:http://www.patest.cn/contests/pat-a-practise/1039 题目: 1039. Course List for Student (25) 时间限制 2 ...
- android-betterpickers
https://github.com/derekbrameyer/android-betterpickers
- 4K Block Size的Device和 Aligned IO
http://www.cnblogs.com/cenalulu/p/3587006.html 背景:最近采购了一批新的服务器,底层的存储设备的默认physical sector size从原有的 ...
- UEditor-JSP版部署说明
昨天项目中需要在UEditor用到图片上传功能,于是昨天中午便开始做这一块的整合,一不小心就弄到了现在, 坑还挺多的,比如一开始一直报ActionEnter cannot be resolved to ...
- jQuery事件之on()方法绑定多个选择器,多个事件
这样一个需求,如果用live()方法实现的话 非常简单,容易理解. $('nav li, #sb-nav li, #help li').live('click', function () { // c ...
- hdu1051 Wooden Sticks
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1051 大意:求最少升序序列的个数. #include <cstdio> #include &l ...