加载CSS

<link href="../../Public/easyui/SiteEasy.css" rel="stylesheet" type="text/css" />
<link href="../../Public/easyui/default/easyui.css" rel="stylesheet" type="text/css" />

加载JS

<script src="../../Public/easyui/jquery-1.6.min.js" type="text/javascript"></script>
<script src="../../Public/easyui/jquery.easyui.min.js" type="text/javascript"></script>
<script src="../../Public/easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script src="/Themes/Scripts/DatePicker/WdatePicker.js" type="text/javascript"></script>

JS加载显示的数据

 $('#Grid').datagrid({
width: 'auto',
height: document.documentElement.offsetHeight - 60,
nowrap: true,
striped: true,
collapsible: true,
url: 'ShenHe_List.aspx',
queryParams: { key: escape($('#txtKey').val()), type: 'GetList', YLBXID: $("select[name$=fm_ylbxmc]").val(), BXZCBH: $("select[name$=fm_bxzcxx]").val() },
sortName: 'YLBXID',
sortOrder: 'desc',
remoteSort: false,
pageList: [20, 40, 80, 160],
columns: [[
{ field: 'ZLZMBH', title: '诊疗证书编号', width: 80, sortable: true, align: 'center' },
{ field: 'ZMLX', title: '证明类型', width: 80, sortable: true, align: 'center', formatter: function (value) {
switch (value) {
case "01":
return "诊断证明";
break;
case "02":
return "病假证明";
break;
case "03":
return "护理证明";
break;
case "04":
return "费用证明";
break;
case "05":
return "返校证明";
break;
}
}
},
{ field: 'JLLY', title: '记录来源', width: 60, sortable: true, align: 'center', formatter: function (value) {
switch (value) {
case "00":
return "门诊";
break;
case "01":
return "急诊";
break;
case "10":
return "住院";
break;
} }
},
{ field: 'BRXM', title: '病人姓名', width: 70, sortable: true, align: 'center' },
{ field: 'SFZHM', title: '身份证号', width: 150, sortable: true, align: 'center' },
{ field: 'BRXB', title: '性别', width: 50, sortable: true, align: 'center' },
{ field: 'BRNL', title: '病人年龄', width: 70, sortable: true, align: 'center' },
{ field: 'RYSJ', title: '就诊时间', width: 110, sortable: true, align: 'center' },
{ field: 'CYSJ', title: '离诊时间', width: 110, sortable: true, align: 'center' },
{ field: 'LCZD', title: '临床诊断', width: 150, sortable: true, align: 'center' },
{ field: 'CLJY', title: '处理意见', width: 150, sortable: true, align: 'center' },
{ field: 'KSDM', title: '科室代码', width: 70, sortable: true, align: 'center' },
{ field: 'KSMC', title: '科室名称', width: 70, sortable: true, align: 'center' },
{ field: 'YSDM', title: '医生代码', width: 70, sortable: true, align: 'center' },
{ field: 'YSXM', title: '医生姓名', width: 70, sortable: true, align: 'center' },
{ field: 'BJTS', title: '病假天数', width: 60, sortable: true, align: 'center' },
{ field: 'KDSJ', title: '开证明时间', width: 110, sortable: true, align: 'center' },
{ field: 'DWDZ', title: '单位地址', width: 150, sortable: true, align: 'center' },
{ field: 'SHJG', title: '审核结果', width: 60, sortable: true, align: 'center', formatter: function (value) {
switch (value) {
case "0":
return "未审核";
break;
case "1":
return "合格同意";
break;
case "9":
return "不合格";
break;
} }
} ]],
pagination: true,
rownumbers: true,
singleSelect: true,
onDblClickRow: function () {
update();
},
onLoadSuccess: function (data) {
var bodyTds = $(".datagrid-body table tr");
bodyTds.each(function () {
$("td:eq(2) div", this).css("text-align", "left");
$("td:eq(3) div", this).css("text-align", "left");
})
}
}).datagrid('getPager').pagination({
showPageList: false,
showRefresh: false
});

URL 是调用数据的路径

queryParams 是传递的参数

sortName 排序字段

columns:显示的字段数据

{ field: 'JLLY', title: '记录来源', width: 60, sortable: true, align: 'center', formatter: function (value) {
switch (value) {
case "00":
return "门诊";
break;
case "01":
return "急诊";
break;
case "10":
return "住院";
break;
} }
}

以上代码

formatter: function (value){}格式是替换数据

onDblClickRow 双击的事件
onLoadSuccess 加载完成后的时间

加载datagrid

<td align="left" style="height: 100%;">
<table id="Grid">
</table>
</td>

后台方法

private void GetList()
{ string sql = string.Format("SELECT distinct * FROM zm_zlzm "); DataTable dt = DbHelperOra.QueryTable(sql); string strWhere = "";
DataSet ds = GetList(int.Parse(Request["rows"]), int.Parse(Request["page"]), strWhere); //把DataTable转化成json
string josn = JSONHelper.JSONDataTable(ds.Tables[], Count(strWhere).ToString());
Response.Clear();
Response.Write(josn);
Response.End();
}

后台返回的JASON数据:

{ "total": ,"rows":[ { "ZLZMBH":"Z2","ZLZMDM":"","JLLY":"","SFZHM":"","BRXM":"","BRXB":"男","BRNL":"","DWDZ":"","RYSJ":"","CYSJ":"","LCZD":"","CLJY":"","KSDM":"","KSMC":"","YSDM":"","YSXM":"","KDSJ":"","SHDM":"","SHRXM":"","SHSJ":"","SHJG":"","SHRDM":"","ZC":"","BJTS":"","ZMLX":"","JBDM":"","JBMC":"","RN":""}, { "ZLZMBH":"B2","ZLZMDM":"","JLLY":"","SFZHM":"","BRXM":"","BRXB":"男","BRNL":"","DWDZ":"","RYSJ":"","CYSJ":"","LCZD":"","CLJY":"","KSDM":"","KSMC":"","YSDM":"","YSXM":"","KDSJ":"","SHDM":"","SHRXM":"","SHSJ":"","SHJG":"","SHRDM":"","ZC":"","BJTS":"","ZMLX":"","JBDM":"","JBMC":"","RN":""}, { "ZLZMBH":"Z4","ZLZMDM":"","JLLY":"","SFZHM":"","BRXM":"","BRXB":"男","BRNL":"","DWDZ":"","RYSJ":"","CYSJ":"","LCZD":"","CLJY":"","KSDM":"","KSMC":"","YSDM":"","YSXM":"","KDSJ":"","SHDM":"","SHRXM":"","SHSJ":"","SHJG":"","SHRDM":"","ZC":"","BJTS":"","ZMLX":"","JBDM":"","JBMC":"","RN":""}, { "ZLZMBH":"","ZLZMDM":"","JLLY":"","SFZHM":"","BRXM":"","BRXB":"男","BRNL":"","DWDZ":"","RYSJ":"","CYSJ":"","LCZD":"","CLJY":"","KSDM":"","KSMC":"","YSDM":"","YSXM":"","KDSJ":"","SHDM":"","SHRXM":"","SHSJ":"","SHJG":"","SHRDM":"","ZC":"","BJTS":"","ZMLX":"","JBDM":"","JBMC":"","RN":""}, { "ZLZMBH":"F00000001","ZLZMDM":"","JLLY":"","SFZHM":"","BRXM":"张三","BRXB":"男","BRNL":"14岁","DWDZ":"杭州市","RYSJ":"2015/2/10 0:00:00","CYSJ":"2015/2/10 0:00:00","LCZD":"临床诊断000","CLJY":"无处理意见","KSDM":"","KSMC":"儿科","YSDM":"","YSXM":"李四","KDSJ":"2015/2/10 0:00:00","SHDM":"","SHRXM":"胡谦","SHSJ":"0001/1/1 0:00:00","SHJG":"","SHRDM":"","ZC":"","BJTS":"","ZMLX":"","JBDM":"","JBMC":"","RN":""}, { "ZLZMBH":"F2","ZLZMDM":"","JLLY":"","SFZHM":"","BRXM":"张三","BRXB":"男","BRNL":"14岁","DWDZ":"杭州市","RYSJ":"2015/2/10 0:00:00","CYSJ":"2015/2/10 0:00:00","LCZD":"","CLJY":"","KSDM":"","KSMC":"儿科","YSDM":"","YSXM":"李四","KDSJ":"2015/2/10 0:00:00","SHDM":"","SHRXM":"","SHSJ":"0001/1/1 0:00:00","SHJG":"","SHRDM":"","ZC":"","BJTS":"","ZMLX":"","JBDM":"","JBMC":"","RN":""}, { "ZLZMBH":"Z0","ZLZMDM":"","JLLY":"","SFZHM":"","BRXM":"张三","BRXB":"男","BRNL":"14岁","DWDZ":"杭州市","RYSJ":"2015/2/10 0:00:00","CYSJ":"2015/2/10 0:00:00","LCZD":"","CLJY":"","KSDM":"","KSMC":"儿科","YSDM":"","YSXM":"李四","KDSJ":"2015/2/10 0:00:00","SHDM":"","SHRXM":"","SHSJ":"0001/1/1 0:00:00","SHJG":"","SHRDM":"","ZC":"","BJTS":"","ZMLX":"","JBDM":"","JBMC":"","RN":""}, { "ZLZMBH":"Z1","ZLZMDM":"","JLLY":"","SFZHM":"","BRXM":"张三","BRXB":"男","BRNL":"14岁","DWDZ":"杭州市","RYSJ":"2015/2/10 0:00:00","CYSJ":"2015/2/10 0:00:00","LCZD":"","CLJY":"","KSDM":"","KSMC":"儿科","YSDM":"","YSXM":"李四","KDSJ":"2015/2/10 0:00:00","SHDM":"","SHRXM":"","SHSJ":"0001/1/1 0:00:00","SHJG":"","SHRDM":"","ZC":"","BJTS":"","ZMLX":"","JBDM":"","JBMC":"","RN":""}, { "ZLZMBH":"Y00000001","ZLZMDM":"","JLLY":"","SFZHM":"","BRXM":"","BRXB":"男","BRNL":"","DWDZ":"","RYSJ":"","CYSJ":"","LCZD":"","CLJY":"","KSDM":"","KSMC":"","YSDM":"","YSXM":"","KDSJ":"","SHDM":"","SHRXM":"","SHSJ":"","SHJG":"","SHRDM":"","ZC":"","BJTS":"","ZMLX":"","JBDM":"","JBMC":"","RN":""}, { "ZLZMBH":"Z3","ZLZMDM":"","JLLY":"","SFZHM":"","BRXM":"","BRXB":"男","BRNL":"","DWDZ":"","RYSJ":"","CYSJ":"","LCZD":"","CLJY":"","KSDM":"","KSMC":"","YSDM":"","YSXM":"","KDSJ":"","SHDM":"","SHRXM":"","SHSJ":"","SHJG":"","SHRDM":"","ZC":"","BJTS":"","ZMLX":"","JBDM":"","JBMC":"","RN":""}, { "ZLZMBH":"B00000001","ZLZMDM":"","JLLY":"","SFZHM":"","BRXM":"李时珍","BRXB":"男","BRNL":"78岁","DWDZ":"杭州是","RYSJ":"2016/1/5 0:00:00","CYSJ":"2016/1/7 0:00:00","LCZD":"牙疼","CLJY":"拔牙","KSDM":"","KSMC":"口腔科","YSDM":"","YSXM":"大洋","KDSJ":"2016/1/20 0:00:00","SHDM":"","SHRXM":"","SHSJ":"","SHJG":"","SHRDM":"","ZC":"","BJTS":"","ZMLX":"","JBDM":"","JBMC":"","RN":""} ]}

显示效果

.net+easyui系列--datagrid的更多相关文章

  1. easyUI 中datagrid 返回列隐藏方法

    easyui的datagrid方法返回的列,有的值不需要显示可以使用hidden(属性进行隐藏) columns : [ [{ field : 'bailClass', title : '类别', w ...

  2. EasyUI 中 DataGrid 控件 列 如何绑定对象中的属性

    EasyUI 中 DataGrid 控件 是我们经常用到的控件之一, 但是 DataGrid 控件 在绑定显示列时却不支持对象属性绑定. 模型如下: public class Manager impl ...

  3. easyui的datagrid行的某一列添加链接

    通过formatter方法给easyui 的datagrid 每行增加操作链接. 效果图 jsp代码: <th field="url" width="100&quo ...

  4. easyui的datagrid打印(转)

    在使用easyui插件的时候,使用最多的应该是datagrid插件.有时候根据客户需求,可能需要将datagrid内容进行打印,这时候如果直接调用window.print,可能由于easyui的dat ...

  5. EasyUI的datagrid分页

    EasyUI的datagrid分页 前台代码: <script type="text/javascript"> $(function () { //查询 search( ...

  6. easyui使用datagrid时列名包含特殊字符导致表头与数据错位的问题

    做一个用easyui的datagrid显示数据的功能时发现表格的列头与数据错位了,而且这个现象不总是能重现,一直没搞清楚原因.后来偶然在控制台看出了一点端倪: 推测表头或者单元格的class名应该是用 ...

  7. 利用Aspose.Cells完成easyUI中DataGrid数据的Excel导出功能

    我准备在项目中实现该功能之前,google发现大部分代码都是利用一般处理程序HttpHandler实现的服务器端数据的Excel导出,但是这样存在的问题是ashx读取的数据一般都是数据库中视图的数据, ...

  8. 修改easyui中datagrid表头和数据不能分开对齐的BUG。

    easyui的datagrid中表头和列只能同时全部向左对齐,全部向右对齐或者居中对齐. 有时候有需求,数据向左或向右,表头居中对齐. 在不修改源码的情况下.下面的代码可以实现该功能. 把下面代码放在 ...

  9. JQuery EasyUI的datagrid的使用方式总结

    JQuery EasyUI的datagrid的使用方式总结第一步:添加样式和js脚本在前台添加展示数据表格的table元素 例如: <div> <table id="tt& ...

随机推荐

  1. 23个移动app界面上的旋钮和刻度盘设计示例

      摘要: 从最初进入电子设备领域,旋钮和刻度盘的由最初的功能性设计转变为时尚的外观设计元素,比如在移动app中.这种转变并意外,旋钮和刻度盘不需要占用移动设备的太多空间,并可以简单地为用户提供一些列 ...

  2. 时区 : America/Mexico_City 中文:美国中部时间(墨西哥城) 的夏令时

    方法: (参数为: TimeZone timeZone = TimeZone.getTimeZone("America/Mexico_City"); private static ...

  3. Linux libtins 库安装教程

    因为工作原因需要用到libtins网络库, 所以今天去装一下. 很尴尬,由于本人对linux理解比较浅, 所以在中途遇到了一些问题. 虽然只是简单的安装步骤,但是阻挡不了自己菜啊. 一.  下载lib ...

  4. linux .o,.a,.so文件解析

    linux下文件的类型是不依赖于其后缀名的,但一般来讲:.o,是目标文件,相当于windows中的.obj文件.so 为共享库,是shared object,用于动态连接的,和dll差不多.a为静态库 ...

  5. winform代码反编译后图片等资源文件恢复解决方案

    用Reflector工具反编译的winform代码,图片等资源文件不能很好的反编译成功. 这里有一个笨的解决方案.首先我们要了解图片资源当初加入到工程的几种方式,及他们所在的位置. 一般winform ...

  6. hdoj 1166 敌兵布阵【线段树求区间最大值+单点更新】

    敌兵布阵 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submis ...

  7. hdoj 4006 The kth great number【优先队列】

    The kth great number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Oth ...

  8. UVA 10047 The Monocycle (状态记录广搜)

    Problem A: The Monocycle  A monocycle is a cycle that runs on one wheel and the one we will be consi ...

  9. []cp,转载]提示MyEclipse Trial Expired,如何手动获取MyEclipse 注册码!很牛!

    1.建立JAVA Project,随便命名,只要符合规则就行. 2.在刚刚建好的Project右击src,新建一个类,命名为MyEclipseGen,把.java里本来有的代码全部删掉,再把下面的代码 ...

  10. 修复南尼U盘

    通常拿到手的U盘,用数码之家的ChipGenius一般检测不出主控型号,所以需要用到U盘量产工具来测. 量产工具注意版本 一般靠后的版本才能识别使用, . 如果识别不了==> 自动换成手动,U盘 ...