树形表格:
<table id="treeGridDg"></table>js代码:
<script>toolbar对应的html:
//获取id
var url = window.location.href.toString();
urlData = "";
dataString = [];
dataJson = {};
arr = [];
if (url != "") {
urlData = url.split("?")[1];
dataString = urlData.split("&");
for (var i = 0, len = dataString.length; i < len; i++) {
arr = dataString[i].split("=");
dataJson[arr[0]] = arr[1];
}
}
else {
dataJson = null;
}
var url = '/SimLib/module/plane?parent=' + dataJson.id;
$("#treeGridDg").iTreegrid({
url:url,
idField:'id',
treeField:'name',
expandUrl:'/SimLib/module/plane?parent={id}',
fitColumns:true,
columns:[[
{field:'id',title:'ID',checkbox:true},
{field:'name',title:'名称',width:80},
{field:'module_id',title:'标识',width:80},
{field:'author',title:'作者',width:80},
{field:'parent',title:'父类',width:80},
{field:'project',title:'所属项目',width:80},
{field:'description',title:'描述',width:100}
]]
});
$("#add").iMenubutton({
method: 'openDialog',
extend: '#treeGridDg-toolbar',
iconCls: 'fa fa-plus',
dialog: {
id: 'userAddDialog',
title: '多选项卡布局的表单',
href: _ctx + '/html/complex/dialog_add.html',
buttonsGroup: [
{
text: '保存',
url: _ctx + '/json/response/success.json',
iconCls: 'fa fa-plus',
handler: 'ajaxForm',
btnCls: 'topjui-btn-brown'
}
]
}
});
</script>
<!-- 树形表格tab -->
<div id="treeGridDg-toolbar" class="topjui-toolbar"
data-options="grid:{
type:'datagrid',
id:'treeGridDg'
}">
<a id="add" href="javascript:void(0)">新增</a>
</div>