在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
页面代码 @{ Layout = null; } <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width" /> <title>PurchaseOrderDetail</title> <link href="~/Content/themes/blue/easyui.css" rel="stylesheet" /> <link href="~/Content/themes/blue/icon.css" rel="stylesheet" /> <script src="~/Scripts/jquery.min.js"></script> <script src="~/Scripts/jquery.easyui.min.js"></script> <script type="text/javascript"> $(function () { $('#List2').datagrid({ title: 'Checkbox selection on DataGrid', url: 'GetPurchaseOrder', method: 'get', //默认是post,不允许对静态文件访问 width: '700', iconCls: 'icon-save', dataType: "json", fitColumns: true, rownumbers: true, //是否加行号 pagination: true, //是否显式分页 pageSize: 15, //页容量,必须和pageList对应起来,否则会报错 pageNumber: 2, //默认显示第几页 pageList: [15, 30, 45],//分页中下拉选项的数值 columns: [[ { field: 'ck', checkbox: true }, { field: 'PKID', title: 'id' }, { field: 'REAL_NAME', title: '姓名' }, { field: 'MOBILE', title: '手机号码' }, { field: 'STAFF_CODE', title: '编号' } ]], singleSelect: false, //允许选择多行 selectOnCheck: true,//true勾选会选择行,false勾选不选择行, 1.3以后有此选项 checkOnSelect: true //true选择行勾选,false选择行不勾选, 1.3以后有此选项 }); }); </script> </head> <body> <div style="margin:10px 0;"></div> <table id="List2" class="easyui-datagrid"></table> </body> </html>
控制器 代码
ZG_ERPEntities erp = new ZG_ERPEntities(); public JsonResult GetPurchaseOrder(int? page, int? rows) { page = page == null ? 1 : page; rows = rows == null ? 1 : rows; List<TSYS_USER> list = erp.TSYS_USER.OrderBy(a=>a.PKID).Skip((Convert.ToInt32(page) - 1) * Convert.ToInt32(rows)).Take( Convert.ToInt32(rows)).ToList(); var json = new { total = erp.TSYS_USER.Count(), rows = (from r in list select new TSYS_USER() { PKID=r.PKID, REAL_NAME=r.REAL_NAME, MOBILE=r.MOBILE, STAFF_CODE=r.STAFF_CODE }).ToArray() }; return Json(json, JsonRequestBehavior.AllowGet); }
如 |
请发表评论