easy UIはデータを取得し、弾丸窓を開く
6076 ワード
<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>