KENDOUI控件 GRID中TEMPLATE中条件判断的使用
var tempgrid = $("#grid").kendoGrid({ dataSource: { requestStart: function (e) { kendo.ui.progress($("#grid"), true); }, requestEnd: function (e) { kendo.ui.progress($("#grid"), false); }, transport: { read: { url: "/Project/GetAEByProId", dataType: "json" } }, pageSize: 1, serverPaging: true, serverFiltering: true, schema: { type: "json", data: "Data", total: "total", model: { id: "id", fields: { id: "id" } } }, filter: [ { field: "Project_Id", value: @Project_Id } ] }, scrollable: true, sortable: false, filterable: false, attributes: { "class": "grid-algin-center" }, pageable: { refresh: true, pageSizes: true, buttonCount: 5, page: 1, pageSize: 5, pageSizes: [5, 10, 15], messages: { display: "显示 {0}-{1} 共 {2} 项", empty: "没有数据", itemsPerPage: "每面显示数量", first: "第一页", last: "最后一页", next: "下一页", previous: "上一页" } }, columns: [ { field: "CenterName", title: "机构名称", width: "100px" }, { field: "PatientName", title: "姓名", width: "8%", template: "#=PatientName.substring(0,1)#**" }, { field: "AETERM", title: "不良事件名称", width: "100px" }, { field: "AESEVName", title: "严重程度" }, { field: "AESTDAT", title: "开始时间", template: "#=AESTDAT.substring(0,AESTDAT.length-8)#" }, { field: "AEENDAT", title: "结束时间", template: "#=AEENDAT.substring(0,AEENDAT.length-8)#" }, { field: "AEONGODAT", title: "如仍有,目前日期", template: "#=AEONGODAT.substring(0,AEONGODAT.length-8)#" }, { field: "AEACNName", title: "试验药采取措施" }, { field: "AERELName", title: "与研究药物的相关性" }, { field: "AEOUTName", title: "结果" }, { field: "AEDocTitle", title: "AE文档", template:"# if (AEDocTitle != null ) { #'#=AEDocTitle##=ExtensionName#'# } #" } ] });
以上来源:https://blog.csdn.net/u012571917/article/details/82665518
对于.netcore版本来讲
columns.Bound(o => o.kq).Title("考勤号").Width(124).ClientTemplate("# if (kq != null ) { ##=jc##=xm## } else {# 无考勤#}#");
一定要加 href='##' ,不加的话应用主题时显示的字体颜色是表格的样式,而不是按钮的样式!!!