哪位高手有EasyUI treegrid具体实例 包含分页代码
2个回答
展开全部
你可以下载easyui 原jar ,里面包括所有控件的demo
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2014-12-29 · 知道合伙人数码行家
可以叫我表哥
知道合伙人数码行家
向TA提问 私信TA
知道合伙人数码行家
采纳数:25897
获赞数:1464977
2010年毕业于北京化工大学北方学院计算机科学与技术专业毕业,学士学位,工程电子技术行业4年从业经验。
向TA提问 私信TA
关注
展开全部
treegrid.html
HTML code<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>jQuery EasyUI</title>
<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../themes/icon.css">
<script type="text/javascript" src="../jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="../jquery.easyui.min.js"></script>
<script>
$(function(){
$('#test').treegrid({
title:'TreeGrid',
iconCls:'icon-save',
width:500,
height:350,
nowrap: false,
rownumbers: true,
animate:true,
collapsible:true,
url:'treegrid_data.json',
idField:'code',
treeField:'code',
pagination:true,
frozenColumns:[[
{title:'code',field:'code',width:150}
]],
columns:[[
{field:'name',title:'Name',width:120},
{field:'addr',title:'Address',width:120,rowspan:2},
{field:'col4',title:'Col41',width:150,rowspan:2}
]],
onBeforeLoad:function(row,param){
if (row){
$(this).treegrid('options').url = 'treegrid_subdata.json';
} else {
$(this).treegrid('options').url = 'treegrid_data.json';
}
}
});
});
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="#" onclick="reload()">reload</a>
<a href="#" onclick="getChildren()">getChildren</a>
<a href="#" onclick="getSelected()">getSelected</a>
<a href="#" onclick="collapse()">collapse</a>
<a href="#" onclick="expand()">expand</a>
<a href="#" onclick="collapseAll()">collapseAll</a>
<a href="#" onclick="expandAll()">expandAll</a>
<a href="#" onclick="expandTo()">expandTo</a>
</div>
<table id="test"></table>
</body>
</html>
HTML code<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>jQuery EasyUI</title>
<link rel="stylesheet" type="text/css" href="../themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../themes/icon.css">
<script type="text/javascript" src="../jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="../jquery.easyui.min.js"></script>
<script>
$(function(){
$('#test').treegrid({
title:'TreeGrid',
iconCls:'icon-save',
width:500,
height:350,
nowrap: false,
rownumbers: true,
animate:true,
collapsible:true,
url:'treegrid_data.json',
idField:'code',
treeField:'code',
pagination:true,
frozenColumns:[[
{title:'code',field:'code',width:150}
]],
columns:[[
{field:'name',title:'Name',width:120},
{field:'addr',title:'Address',width:120,rowspan:2},
{field:'col4',title:'Col41',width:150,rowspan:2}
]],
onBeforeLoad:function(row,param){
if (row){
$(this).treegrid('options').url = 'treegrid_subdata.json';
} else {
$(this).treegrid('options').url = 'treegrid_data.json';
}
}
});
});
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="#" onclick="reload()">reload</a>
<a href="#" onclick="getChildren()">getChildren</a>
<a href="#" onclick="getSelected()">getSelected</a>
<a href="#" onclick="collapse()">collapse</a>
<a href="#" onclick="expand()">expand</a>
<a href="#" onclick="collapseAll()">collapseAll</a>
<a href="#" onclick="expandAll()">expandAll</a>
<a href="#" onclick="expandTo()">expandTo</a>
</div>
<table id="test"></table>
</body>
</html>
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询