实现效果:

一、在页面头部引用视图脚本JS文件

  <script src="@Url.Content("~/Resources/EasyUI/plugins/datagrid-detailview.js")" type="text/javascript"></script>

二、创建主DataGrid视图

<div id="table">
<table id="tbDataAuthority"></table>
</div>

三、设置详细DataGrid 显示

        $('#tbDataAuthority').datagrid({
striped: true,
url: '/User/BindDataAuthorityGrid',
iconCls: 'icon-edit', //图标
singleSelect: true,
autoRowHeight: false,
rownumbers: true,
fitColumns: true,
border: false,
pagination: true, //是否分页
columns: [[
{ field: 'DANAME', title: '权限名称', width: },
{ field: 'DAKEYCODE', title: '权限编码', width: },
{ field: 'MEMO', title: '描述信息', width: },
{ field: 'DAID', title: '权限ID', width: , hidden: true },
]],
view: detailview,
detailFormatter: function (index, row) {
return '<div style="padding:5px"><table id="tbDataAuthorityItem-' + index + '"></table></div>';
},
onExpandRow: function (index, row) {
$('#tbDataAuthorityItem-' + index).datagrid({
url: '/User/BindDetailGridListByDaId/?daId=' + row.DAID,
fitColumns: true,
singleSelect: true,
rownumbers: true,
loadMsg: '',
height: 'auto',
columns: [[
{ field: 'DAITEMNAME', title: '权限名称', width: },
{ field: 'TRANSFERCODE', title: '转换编码', width: },
{ field: 'MEMO', title: '权限描述顺序', width: },
{ field: 'DAID', title: 'DAID', width: , hidden: 'true' },
{ field: 'DAITEMID', title: 'DAITEMID', width: , hidden: 'true' }
]],
onResize: function () {
$('#tbDataAuthority').datagrid('fixDetailRowHeight', index);
},
onLoadSuccess: function () {
setTimeout(function () {
$('#tbDataAuthority').datagrid('fixDetailRowHeight', index);
}, );
}
});
$('#tbDataAuthority').datagrid('fixDetailRowHeight', index);
}
})

四、解析

当用户点击展开按钮('+')时,'onExpandRow' 事件将被触发,就会渲染一个子DataGrid。

EasyUI DataGrid - 嵌套的DataGrid的更多相关文章

  1. 在jQuery EasyUI中实现对DataGrid进行编辑

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...

  2. 解决ScrollViewer嵌套的DataGrid、ListBox等控件的鼠标滚动事件无效

    C# 中,两个ScrollViewer嵌套在一起或者ScrollViewer里面嵌套一个DataGrid.ListBox.Listview(控件本身有scrollviewer)的时候,我们本想要的效果 ...

  3. datagrid-detailview.js easyui表格嵌套

    datagrid-detailview.js easyui表格嵌套

  4. 关于easyui的tab,layout,datagrid嵌套的问题

    我的项目使用easyui作为前台的展示框架现在页面中是一个layout布局(分上,左,中)在左边是一些菜单,点击后,在中间部分增加一个tab显示内容而增加的tab里面是显示一些列表数据,列表上面是查询 ...

  5. easyui跨iframe属性datagrid

    1.问题 如何刷新easyui父级tab页中iframe嵌套页中的datagrid? 2.解决方法 (1) parent.$("iframe[title='tabtitle']") ...

  6. easyUI跨Tab操作datagrid

    1.在datagrid那个页面定义方法 window.top["RELOAD_MY_DATAGRID"]=function(){ $("#dg").datagr ...

  7. jquery easyui window中的datagrid,只能显示一次问题

    最近项目中用到easyui 的动态创建window ,window中嵌入了datagruid.第一次打开是能显示数据,但再次打开时确没显示: 注:url已成功返回了数据. 多次查阅easyui帮助文档 ...

  8. easyui textarea回车导致datagrid 数据无法展示的问题

    textarea换行 在easyui中的datagrid中使用行内编辑时textarea的换行保存到mysql数据库为\n在textarea中输入回车符 在js读取textarea中的值有\r\n然后 ...

  9. EasyUi–7.tab和datagrid和iframe的问题

    1. 多个tab切换,第2个不显示 动态添加tab Iframe页面的方法 展开 折叠 <script type="text/javascript"> $(functi ...

随机推荐

  1. 用MATLAB结合四种方法搜寻罗马尼亚度假问题

    选修了cs的AI课,开始有点不适应,只能用matlab硬着头皮上了,不过matlab代码全网仅此一份,倒有点小自豪. 一.练习题目 分别用宽度优先.深度优先.贪婪算法和 A*算法求解"罗马利 ...

  2. WordPress修改标签云大小及颜色

    修改WordPress标签字体大小: 在cpanel面板中依次打开「wp-includes」→「category-template.php」,找到wp_tag_cloud, 1 2 3 4 5 6 7 ...

  3. LOOKUP函数入门

    2018-02-11  作者:ExcelHome  阅读:22045次       转载请注明来源"ExcelHome"并保留原文链接.固定链接:http://www.excelh ...

  4. ACCESS_ONCE

    宏定义: #define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x)) 分解: typeof(x):取x的类型,如果x是int,那typeof(x) ...

  5. 使用angular-ui-router替代ng-router

    angular框架自身提供的ng-route在一定程度上满足了我们的需求,但是他只针对于单视图,比如点击一个link跳转到另一个视图,但是在实际业务中,需要一个状态对应的视图中还包含其他的视图,或者一 ...

  6. http.request的请求

    var http=require('http'); var request=require('request'); var body = { "data":{ "id&q ...

  7. ASP.NET MVC编程——错误处理与日记

    ASP.NET MVC的错误处理应考虑到这几个方面:模型绑定期间发生的错误,未能路由到指定操作,针对控制器的错误处理.使用配置文件可以帮助我们处理异常,但是不够灵活和全面:使用HandleErrorA ...

  8. 【Docker】 积累

    ■ 磁盘空间和docker资源之间的关系 通过docker info | grep Space可以看到Docker占据的磁盘空间的信息.其中Data Space Used表示实际上docker资源占用 ...

  9. 【Python】 压缩文件处理 zipfile & tarfile

    [zipfile] 虽然叫zipfile,但是除了zip之外,rar,war,jar这些压缩(或者打包)文件格式也都可以处理. zipfile模块常用的一些操作和方法: is_zipfile(file ...

  10. git项目初始化

    Command line instructions 1.Git global setup git config --global user.name "99176942"git c ...