簡體   English   中英

Kendo UI網格綁定錯誤

[英]Kendo UI grid binding error

我正在使用Kendo UI網格,這是我的代碼

JAVASCRIPT

 $("#logs").kendoGrid({
                    dataSource: {
                        type: "json",
                        transport: {
                            read: {
                                url: "https://localhost:1153/v3.svc/auditlog",
                                dataType: "json",
                                data: '?&tableName=' + table + '&userId=' + userId + '&fromDate=' + dateFrom + '&toDate=' + dateto + '&isSearchForClient=' + true,
                                type: "GET",
                                contentType: "application/json; charset=utf-8"
                            }
                        },
                        pageSize: 10, //page size
                        schema: {
                            data: "d", //root element that contains data array
                            total: "d.length" //total amount of records
                        }
                    },
                    pageable: true, //enable paging
                    columns: [{ field: "d.TransactionId", title: "TransactionID", width: "30px" }, { field: "d.Log", title: "Audit Logs", width: "110px" }]
                });

而來自服務器的東西是這樣的

[ { "TransactionId" : "185492010250010630", "Log" : "Administrator  Super has updated jobdescmanagement on 1/28/2015 4:24:03 PM"}]

它在控制台中給出的錯誤是

Uncaught Sys.ParameterCountException: Sys.ParameterCountException: Parameter count mismatch.

根據您的JSON數據結構字段配置

columns: [{
    field: "TransactionId",
    title: "TransactionID",
    width: "30px"
}, {
    field: "Log",
    title: "Audit Logs",
    width: "110px"
}]

在這種情況下,您不需要schema配置,因為您沒有root JSON元素。

模式

schema: {
    data: "d"
}

表示數據具有以下格式:

{d: [{"TransactionId": "185492010250010630", "Log": "Administrator Super has updated jobdescmanagement on 1/28/2015 4:24:03 PM"}]}

但是,這不是您的情況。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM