kendoui treelist error Request failed!
备注:
treelist初始化代码中url地址写的是本地的json数据:
read: {
url:"json/userTest.json"
}
请求类型都是用“post”
chrome控制台看到的userTest.json数据返回值如下:
现在的问题是json数据请求成功了,控制台并没有报错。这是json数据的问题还是别的什么原因?
附上json文件:
[{"id":1,"EmployeeId":0001,"ReportsTo":80010001,"FirstName":"zhang","LastName":"San","HireDate":"2016-02-08 20:08:08","Phone":"huawei","HireDate":"2015-08-09 11:11:11","BirthDate":"1968-01-09 02:19:02","Extension":"1123223123","Position":"上边"},
{"id":1,"EmployeeId":0001,"ReportsTo":80010001,"FirstName":"zhang","LastName":"San","HireDate":"2016-02-08 20:08:08","Phone":"huawei","HireDate":"2015-08-09 11:11:11","BirthDate":"1968-01-09 02:19:02","Extension":"1123223123","Position":"上边"},
{"id":1,"EmployeeId":0001,"ReportsTo":80010001,"FirstName":"zhang","LastName":"San","HireDate":"2016-02-08 20:08:08","Phone":"huawei","HireDate":"2015-08-09 11:11:11","BirthDate":"1968-01-09 02:19:02","Extension":"1123223123","Position":"上边"}]
kendoui-treelist-初始化代码如下:
$(document).ready(function () {
var crudServiceBaseUrl = "",
dataSource = new kendo.data.TreeListDataSource({
transport: {
read: {
url:"json/userTest.json"
},
update: {
url: "index/test/update",
type: "POST",
},
destroy: {
url: "index/test/del",
type: "POST",
},
create: {
url: "index/test/add",
type: "POST",
},
parameterMap: function(options, operation) {
if (operation !== "read" && options.models) {
// return {models: kendo.stringify(options.models)};
console.info(options.models[0]);
return options.models[0];
}else{
var parameter = {
page: options.page,
pageSize: options.pageSize,
};
console.info(kendo.stringify(parameter));
return parameter;
}
}
},
batch: true,
pageSize: 20,
serverPaging:true,
schema: {
model: {
id:"id",
parentId:"ReportsTo",
fields: {
EmployeeId: { type: "number", editable: false, nullable: false },
ReportsTo: { nullable: true, type: "number" },
FirstName: { validation: { required: true } },
LastName: { validation: { required: true } },
HireDate: { type: "date" },
Phone: { type: "string" },
HireDate: { type: "date" },
BirthDate: { type: "date" },
Extension: { type: "number", validation: { min: 0, required: true } },
Position: { type: "string" }
},
expanded: true
}
}
});
$("#toolbar").kendoToolBar({
items: [
{ name:"create",type: "button", text: "新增", overflow: "never",click: buttonClickHandler },]
});
$("#treelist").kendoTreeList({
dataSource: dataSource,
editable: "inline",
height: 540,
columns: [
{ field: "FirstName", expandable: true, title: "First Name", width: 220 },
{ field: "LastName", title: "Last Name", width: 100 },
{ field: "Position" },
{ field: "HireDate", title: "Hire Date", format: "{0:MMMM d, yyyy}" },
{ field: "Phone", title: "Phone" },
{ field: "Extension", title: "Ext", format: "{0:#}" },
{ title: "Edit", command: [ "edit", "destroy" ], width: 250,
attributes: {
style: "text-align: center;"
}
}
]
});
});
相关阅读:
css请求阻塞网页加载,如何找到请求源。
华为cmpp2.0开发包开发短信
StackEdit 的项目上为什么缺少 MathJax.js
求一个日历效果
有哪些Linux发行版的思想很奇特
CSS Sprites虽然增加了图片的字节,但是很好地减少网页的http请求,从而大大的提高页面的性能
新版firefox下css设置overflow出现的问题?
SF的消息系统怎么设计的
如何动态修改directive templateUrl的值
flask项目部署到SAE的时候静态文件都404
服务器与内网节点的端口映射
编程菜鸟如何规划自己的编程学习之路?
浏览器发送了两次请求给服务器,服务器只返回后一次请求的内容
qq浏览器里的微信调试工具的服务器端调试有人用过吗?
如何获取自定义meta标签信息?
重写init方法后,属性声明后为什么不为nil?
js 怎么实现调用本地录音设备,实现在线录音功能
markdown语言中如何添加背景图片?
win8.1远程桌面连接win2008 server时报错“由于协议错误, 会话将被中断,请重新连接到远程计算机”
pandas如何将生日按星座分组