【发布时间】:2013-07-19 14:51:36
【问题描述】:
这是我创建剑道网格的方法
var grid = $("#grid").kendoGrid({
autobind:true,
dataSource: {
transport: {
read: {
url: "getFacetTree?action=datagrid",
dataType: "json"
}
},
schema: {
model: {
fields: {
Details: { type: "number" },
Date: { type: "string" },
AuthorSender: { type: "string" },
Recipients: { type: "string" },
SubjectFilename: { type: "string" },
Action: { type: "string" }
}
}
},
pageSize: 10,
serverPaging: true,
serverFiltering: true,
serverSorting: true
},
height: 250,
sortable: {
mode: "multiple",
allowUnsort: true
},
filterable: {
extra: false,
operators: {
string: {
startswith: "Starts with",
eq: "Is equal to",
neq: "Is not equal to"
}
}
},
columnMenu: true,
resizable: true,
pageable: {
input: true,
numeric: false,
pageSizes: true,
messages: {
display: "{2} - Documents found, displaying {0} to {1}"
}
},
editable: true,
columns: [
{
field: "",
title: "<input id='headerCheckbox' onclick='selectRows(this)' type='checkbox' name='selected' />",
width: 21,
template: "<input class='rowCheckbox' type='checkbox' name='selected' />"
},
{
field: "Details",
title: "Details",
width: 50
},
{
field: "Date",
title: "Date",
width: 100
},
{
field: "AuthorSender",
title: "Author/Sender",
width: 150
},
{
field: "Recipients",
title: "Recipients",
width: 150
/*filterable: false*/
},
{
field: "SubjectFilename",
title: "Subject/Filename",
width: 150
},
{
field: "Action",
title: "Action",
width: 60
}
]
});
我从数据源得到的响应是 -
[{ Details : 1, Date : "12-06-2000", AuthorSender : "sd", Recipients : "we", SubjectFilename : "abc abc.url", Action : "view"},{ Details : 1, Date : "12-06-2000", AuthorSender : "sd", Recipients : "we", SubjectFilename : "abc abc.url", Action : "view"}]
但响应未在网格中更新。是不是我做错了什么?
Firebug(net tab) 中的分析表明它有 5 个选项卡 - 参数、标题、响应、缓存、XML、Cookie。
在 XML 选项卡下,我得到了这个(也许这是错误的地方)-
XML Parsing Error: syntax error Location: moz-nullprincipal:{c48e084c-70a2-4462-8411-0a950e5325d9} Line Number 1, Column 1:
[{ Details : 1, Date : "12-06-2000", AuthorSender : "sd", Recipients : "w...
【问题讨论】:
-
它工作正常...除了我无法测试您的工具栏模板定义。你能在你的OP中加入
template1吗? -
@OnaBai - 更新了代码,移除了模板工具栏……没必要。
-
然后它工作正常!您是否检查了在浏览器中打开 getFacetTree?action=datagrid 是否实际返回了您发布的内容?
-
是的,它会返回。请检查我添加的有问题的萤火虫相关信息。你能从中得到什么提示吗?谢谢。
-
您的系统似乎认为它是 XML 而不是 JSON。你是返回 JSON、JSONP、...
标签: jquery kendo-ui kendo-grid