jquery easyui treegrid demo

[
{title:'code',field:'code',width:150}
][
{field:'name',title:'Name',width:120},
{field:'size',title:'Size',width:120,rowspan:2},
{field:'date',title:'date',width:150,rowspan:2}
]
});
});

function reload(){
$('#test').treegrid('reload');
}
function getChildren(){
var node = $('#test').treegrid('getSelected');
if (node){
var nodes = $('#test').treegrid('getChildren', node.code);
} else {
var nodes = $('#test').treegrid('getChildren');
}
var s = '';
for(var i=0; i<nodes.length; i++){
s += nodes[i].code + ',';
}
alert(s);
}
function getSelected(){
var node = $('#test').treegrid('getSelected');
if (node){
alert(node.code+":"+node.name);
}
}
function collapse(){
var node = $('#test').treegrid('getSelected');
if (node){
$('#test').treegrid('collapse', node.code);
}
}
function expand(){
var node = $('#test').treegrid('getSelected');
if (node){
$('#test').treegrid('expand', node.code);
}
}
function collapseAll(){
$('#test').treegrid('collapseAll');
}
function expandAll(){
$('#test').treegrid('expandAll');
}
function expandTo(){
$('#test').treegrid('expandTo', '02013');
$('#test').treegrid('select', '02013');
}
</script>
</head>
<body>
<h1>TreeGrid</h1>
<div style="margin:10px;">
<a href="#" οnclick="reload()">reload</a>
<a href="#" οnclick="getChildren()">getChildren</a>
<a href="#" οnclick="getSelected()">getSelected</a>
<a href="#" οnclick="collapse()">collapse</a>
<a href="#" οnclick="expand()">expand</a>
<a href="#" οnclick="collapseAll()">collapseAll</a>
<a href="#" οnclick="expandAll()">expandAll</a>
<a href="#" οnclick="expandTo()">expandTo</a>
</div>
<table id="test"></table>

</body>
</html>


<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Treegrid分页 - jQuery EasyUI Demo</title>
<link rel="stylesheet" type="text/css" href="themes/metro/easyui.css">
<link rel="stylesheet" type="text/css" href="themes/icon.css">
<script type="text/javascript" src="jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="jquery.easyui.min.js"></script>
<script>
$(function(){
$("#tt").treegrid({
url: 'treegrid-data.php',
idField: 'areaid',
treeField: 'name',
rownumbers: true,
pagination: true,
fitColumns: true,
autoRowHeight: false,
onLoadSuccess: function() {
delete $(this).treegrid('options').queryParams['id'];
}
});
});
</script>
</head>
<body>
<h1>Treegrid分页演示</h1>
<p>Treegrid分页的分页其实就是tree的顶级节点分页,下面的子节点其实是不分页的...</p>
<table id="tt" title="Treegrid分页" style="width:550px;height:300px">
<thead>
<tr>
<th data-options="field:'name'" width="200">
名称
</th>
<th data-options="field:'vieworder'" width="200">
排序
</th>
</tr>
</thead>
</table>
</body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值