easy UI获取数据,打开毕弹窗
<div id="modalwindow" class="easyui-window" data-options="modal:true,closed:true,minimizable:false,shadow:false"></div> <button id="pp"></button>
var rows = $('#List').datagrid('getSelections'); $("#modalwindow").html("<iframe width='100%' height='98%' scrolling='no' frameborder='0'' src='/AjaxUser/Create/"+rows[0].id+"'></iframe>"); $("#modalwindow").window({ title: '新增', width: 700, height: 400, iconCls: 'icon-add' }).window('open');
Html全部代码
@{ ViewBag.Title = "Index"; Layout = "~/Views/Shared/_Index_Layout.cshtml"; } <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>GridView</title> <script type="text/javascript"> $(function () { $('#List').datagrid({ toolbar: [{ text: '添加', iconCls: 'icon-add', height:50, handler: function () { $('#List').datagrid('endEdit', lastIndex); lastIndex = $('#List').datagrid('getRows').length - 1; $('#List').datagrid('selectRow', lastIndex); $('#List').datagrid('beginEdit', lastIndex); } }, '-', { text: '删除', iconCls: 'icon-remove', height: 50, handler: function () { var row = $('#List').datagrid('getSelected'); if (row) { var index = $('#List').datagrid('getRowIndex', row); $('#List').datagrid('deleteRow', index); } } }, '-', { text: '保存', iconCls: 'icon-save', height: 50, handler: function () { var row = $('#List').datagrid('getSelected'); if (row != null) { $("#modalwindow").html("<iframe width='100%' height='99%' frameborder='0' src='/SysSample/Edit?id=" + row.Id + "&Ieguid=" + GetGuid() + "'></iframe>"); $("#modalwindow").window({ title: '编辑', width: 700, height: 430, iconCls: 'icon-edit' }).window('open'); } else { $.messageBox5s('提示', '请选择要操作的记录'); } } }, '-', { text: '刷新', height: 50, iconCls: 'icon-undo', handler: function () { $('#List').datagrid('rejectChanges'); } }, '-', { text: '搜索', height: 50, iconCls: 'icon-search', handler: function () { var rows = $('#List').datagrid('getSelections'); $("#modalwindow").html("<iframe width='100%' height='98%' scrolling='no' frameborder='0'' src='/AjaxUser/Create/"+rows[0].id+"'></iframe>"); $("#modalwindow").window({ title: '新增', width: 700, height: 400, iconCls: 'icon-add' }).window('open'); } }], title:"DataGrid的标题", url: '/AjaxUser/loadjson2', width: 500, methord: 'post', height:500, fitColumns: true, sortName: 'id', sortOrder: 'desc', idField: 'id', pageSize: 20, //pageList: 20, pagination: true, striped: true, //奇偶行是否区分 singleSelect: true,//单选模式 rownumbers: true,//行号 columns: [[ { field: 'id', title: 'id', width: 80 }, { field: 'realname', title: '名称', width: 120 }, { field: 'sex', title: 'sex', width: 80, align: 'left' } ]] }); }); </script> </head> <body> <div> <table id="List"></table> <div id="modalwindow" class="easyui-window" data-options="modal:true,closed:true,minimizable:false,shadow:false"></div> <button id="pp"></button> </div> </body> </html>