欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

KendoUi控件kendoGrid中template中条件判断的使用

程序员文章站 2022-05-13 20:53:27
...

KendoUi控件kendoGrid中template中条件判断的使用

KendoUi控件kendoGrid中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: "<div >#=PatientName.substring(0,1)#**</div >"
                    },
                    {
                        field: "AETERM",
                        title: "不良事件名称", width: "100px"
                    },
                    {
                        field: "AESEVName",
                        title: "严重程度"
                    },
                    {
                        field: "AESTDAT",
                        title: "开始时间", template: "<div>#=AESTDAT.substring(0,AESTDAT.length-8)#</div >"
                    },
                    {
                        field: "AEENDAT", title: "结束时间", template: "<div>#=AEENDAT.substring(0,AEENDAT.length-8)#</div >"
                    },

                    {
                        field: "AEONGODAT",
                        title: "如仍有,目前日期", template: "<div>#=AEONGODAT.substring(0,AEONGODAT.length-8)#</div >"
                    },
                    {
                        field: "AEACNName", title: "试验药采取措施"
                    },
                    {
                        field: "AERELName", title: "与研究药物的相关性"
                    },
                    {
                        field: "AEOUTName", title: "结果"
                    },
                    {
                        field: "AEDocTitle", title: "AE文档", template:"# if (AEDocTitle != null ) { #'<a class='btn btn-xs green' onclick='downloadFile(#=ID#)'>#=AEDocTitle##=ExtensionName#</a >'# } #"
                    }
                ]
            });
相关标签: 原创