加载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. 文件已经加入.gitignore但是vs并没有显示文件处于ignore状态

    在VS2015的项目文件中看到某些文件的状态比较特殊, 前面被标记了红色的标志, 如下图. 本来以为这是通过VS修改文件属性做到的, 但是光标移到文件上发现显示的是Ignore, 才知道是被git所忽 ...

  2. RubyGems使用

    RubyGems的功能类似于Linux下的apt-get.使用它可以方便第从远程服务器下载并安装Rails. # 安装指定gem包,程序先从本机查找gem包并安装,如果本地没有,则从远程gem安装.g ...

  3. Super Phyllis(穷举+搜索)

    http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2723 题意:给出一些字符串u,v,代表u-&g ...

  4. pcDuino安装vnc进行远程控制

    准备工作: 已经刷好的 pcduino : 点此购买   可选用显示器或者用ssh连接,ssh连接参考 无显示器刷机与使用 1.安装x11vnc 输入下面的命令: sudo apt-get insta ...

  5. maven 下载 源码和javadoc命令

    1:Maven命令下载源码和javadocs 当在IDE中使用Maven时如果想要看引用的jar包中类的源码和javadoc需要通过maven命令下载这些源码,然后再进行引入,通过mvn命令能够容易的 ...

  6. sql server 2005+ 翻页

    select * from ( select row_number() over (order by dm) row,* from t_zycp where dm like '%4%' ) tmp

  7. Entity Framework快速入门笔记—增删改查

    第一步:创建一个控制台应用程序,起名为EFDemo 2. 第二步:创建一个实体模型 (1)在EFDemo项目上面右击选择添加—新建项—在已安装的选项中选择数据—ADO.NET实体对象模型,如图所示: ...

  8. [Entity Framework]获取部分字段的查询

    using (var ObjectContext = new AgentSystemEntities()) { DateTime dt = new DateTime(1997, 1, 1); stri ...

  9. pdb文件部分解释

    pdb文件包含了编译后程序指向源代码的位置信息,用于调试的时候定位到源代码,主要是用来方便调试的. 在程序发布为release模式时,建议将 pdb文件删除, 同时,对外发布的时候,也把 pdb删除, ...

  10. [NOIP2005]采药

    2005年NOIP全国联赛普及组 [题目描述 Description] 辰辰是个天资聪颖的孩子,他的梦想是成为世界上最伟大的医师.为此,他想拜附近最有威望的医师为师.医师为了判断他的资质,给他出了一个 ...