在KENDO UI网格控件中显示JSON对象的子字段

时间:2013-07-16 13:08:35

标签: html json kendo-ui

我有一个KENDO UI GRID控件,JSON中的数据正确显示。在那个JSON中,我在主JSON对象中有一个对象。无论如何都要在列中显示该字段。这是我尝试基于其他网站的一些链接,但它没有奏效。此值也在控制台中正确显示。我该怎么办? 我想在列中显示ID.Value,ID是一个对象。

 var eventsDataSource = new kendo.data.DataSource({
                            data: events,
                            batch: true,
                            schema: {
                                model: {
                                    fields: {
                                        ID.Value : {type:"string"},
                                        CardNumber: { type: "string" },
                                        Description: { type: "string" },
                                        Origin: { type: "Date" },
                                        Priority:{type:"int"},
                                        ReaderName: { type: "string" },
                                        More: { title: "Image"}
                                    },

                                }
                            },
                            pageSize: 8
                        });
                        $("#eventsgrid").kendoGrid(
                            {
                                dataSource: eventsDataSource,
                            navigatable: true,
                            pageable:
                                {
                                input: true,
                                numeric: false
                                },
                                sortable:true,
                            columns: [
                                {
                                    field: "ID.Value",style:"display:none"
                                },
                            {
                                field:"",width:"30px", template:'<input type="checkbox" id="selectevent"/>'
                            },
                            {
                                field:"CardNumber",width:"80px"
                            },
                            {
                                field: "Image", width: "45px", title: "Type", template: "<img src='/Content/Themes/Default/images/AlarmType.png' id='AlarmType'/>"
                            },
                            {
                                field: "Priority", width: "60px", title: "Priroty"
                            },
                            {
                                field: "Origin", title:"Event Time"
                            },
                            {
                                field:"Description", title:"Alarm Title"
                            },
                            {
                                field: "ReaderName", title: "Location"
                            },
                            {
                                field: "", title: "Actions and Interactions", width: "160px", template: '<input type="button" data-id=ID value="Acknowledge" onclick="javascript:CheckAck(this);" id="Acknowledge" /><br/><a href="javascript:performActions()"  >3 Actions</a>'
                            },
                            {
                                field: "Image", title: "More", width: "60px", template: "<img src='/Content/Themes/Default/images/Door.png' onclick='showDetails()' id='door' width='20' height='20'/><div id='cardholderdetails'></div>"
                            }

                            ],

                        }).data("kendoGrid");

0 个答案:

没有答案