Kendo Web UI 是个不错的Jquery框。可惜老外写的,很多都是默认的英文,当然我们也可以设置成中文,接下来,我们就看看Grid是如何实现的数据绑定(Kendo Grid数据绑定实现有很多方法我这只是一种,我觉得还比较简洁)和如何设置中文。先看看图

数据实现

<div id="grid">

</div>
<script type="text/javascript">

$(function () {
$.ajaxSettings.async = false;
$.ajax({
url: 'MyCostView',
type: 'get',
success: function (e) {
$("#grid").kendoGrid({
columns: [
{ field: "PayName", title: "消费者", width: "90px" },
{ field: "PayMoney", title: "消费金额", width: "100px" }, /* group by this column to see the footer template */
{ field: "PayType", title: "消费类型", width: "100px" },
{ field: "PayWay", title: "消费方式", width: "100px" },
{ field: "PayDescribe", title: "消费详细", width: "200px" },
{ field: "PayAddress", title: "消费地址", width: "150px" },
{ field: "WeekDate", title: "消费日期", width: "100px" },
{ field: "PayDate", title: "具体日期", format:"{0:yyyy/MM/dd}", width: "100px" },
{ command: [{ name: "edit", text: { edit: "编辑", cancel: "取消", update: "更新" } }, { name: "destroy", text: "删除" }] }
],
toolbar: [{ name: "create", text: "新增" }],
editable: {
mode: "popup",
window: {
title: "消费单"
}
, template: kendo.template($("#popup-editor").html())
},
save: function (e) {

}

,
dataSource: {
data: e
, schema: {
model: {
id: "id"
, fields: {
PayName: { type:"string", validation: { required: true } },
PayMoney: { type: "number", validation: { min: 0, required: true } },
PayType: { type:"string",validation: { required: true } },
PayWay: { type: "string", validation: { required: true } },
PayDescribe: { type: "textarea", validation: { required: true } },
PayAddress: { type: "textarea" },
WeekDate: { type: "string", validation: { required: true } },
PayDate: {
type: "date", validation: { min: 0, required: true }
}
}
}
}

},
pageable: {
pageSizes: true,
buttonCount: 10
}
});
}
})
});
</script>

接下来我为大家 拆分一下数据绑定首先我们先要设置要绑定的字段

$("#grid").kendoGrid({
columns: [
{ field: "PayName", title: "消费者", width: "90px" },
{ field: "PayMoney", title: "消费金额", width: "100px" }, /* group by this column to see the footer template */
{ field: "PayType", title: "消费类型", width: "100px" },
{ field: "PayWay", title: "消费方式", width: "100px" },
{ field: "PayDescribe", title: "消费详细", width: "200px" },
{ field: "PayAddress", title: "消费地址", width: "150px" },
{ field: "WeekDate", title: "消费日期", width: "100px" },
{ field: "PayDate", title: "具体日期", format:"{0:yyyy/MM/dd}", width: "100px" },
{ command: [{ name: "edit", text: { edit: "编辑", cancel: "取消", update: "更新" } }, { name: "destroy", text: "删除" }] }
]这样就可以因为默认的改成中文。效果大家自己去试试

接下来就是

editable: {
mode: "popup",
window: {
title: "消费单"
}
}

当编辑的时候就会弹出窗口。kendo会默认设置好所有展现在grid的字段如图

save: function (e) {

}

当单击更新的时候出发事件,e.model.字段

dataSource: {
data: e
, schema: {
model: {
id: "id"
, fields: {
PayName: { type:"string", validation: { required: true } },
PayMoney: { type: "number", validation: { min: 0, required: true } },
PayType: { type:"string",validation: { required: true } },
PayWay: { type: "string", validation: { required: true } },
PayDescribe: { type: "textarea", validation: { required: true } },
PayAddress: { type: "textarea" },
WeekDate: { type: "string", validation: { required: true } },
PayDate: {
type: "date", validation: { min: 0, required: true }
}
}
}
}

},
pageable: {
pageSizes: true,
buttonCount: 10
}

上面这个是数据绑定与分页

fields: {
PayName: { type:"string", validation: { required: true } },
PayMoney: { type: "number", validation: { min: 0, required: true } },
PayType: { type:"string",validation: { required: true } },
PayWay: { type: "string", validation: { required: true } },
PayDescribe: { type: "textarea", validation: { required: true } },
PayAddress: { type: "textarea" },
WeekDate: { type: "string", validation: { required: true } }

指定指段显示类型,验证是否必填,可能描述的不是很详细我觉得大家看看源代码应该理解大概意思。

转载于:https://www.cnblogs.com/qmli/p/3633797.html

Kendo Web UI Grid数据绑定,删除,编辑,并把默认英文改成中文相关推荐

  1. Kendo Web UI Grid里时间格式转换

    我和大家分享一下我的kendo的学习心得.如果不好的地方多多包含或者给我留言请看图 kendo里时间格式如图Oder Date列里的格式.但是我们想把时间转换成中国人习惯的格式.如Shipped Da ...

  2. 解决vue-admin-template插件element UI组件默认英文改中文

    其实vue-admin-template这个框架原来就有的 1.element UI里的组件改中文模式如图: src/main.js: 2.第三方插件如tinymic这个富文本插件改成中文显示,上面方 ...

  3. Web相关语言、标签、文件类型等英文全称、中文释义总结

    Web 英文全称 中文释义 a anchor 锚点 ajax Asynchronous Javascript And XML 异步JavaScript和XML ashx ashx 一般处理程序的扩展名 ...

  4. txt文本改html没有用,编辑html格式文本可改成txt格式(可以替换或更换某文本)新手...

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 新的名字 生活助手 If Clock.Hour < 12 Then TextWindow.WriteLine("早上好,测试者" ...

  5. 文本怎么换成html,编辑html格式文本可改成txt格式(可以替换或更换某文本)新手...

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 新的名字 生活助手 If Clock.Hour < 12 Then TextWindow.WriteLine("早上好,测试者" ...

  6. html文本改,编辑html格式文本可改成txt格式(可以替换或更换某文本)新手

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 新的名字 生活助手 If Clock.Hour < 12 Then TextWindow.WriteLine("早上好,测试者" ...

  7. txt文本如何改html类型,编辑html格式文本可改成txt格式(可以替换或更换某文本)新手...

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 新的名字 生活助手 If Clock.Hour < 12 Then TextWindow.WriteLine("早上好,测试者" ...

  8. Kendo UI Grid 用法详细整理

    目录 一. kendo UI grid结构 结构实例 二. kendo UI grid常用属性 1.new kendo.data.DataSource()中常见属性: 2.$("#grid& ...

  9. ComponentArt.web.ui中文帮助之Grid(六)

    ComponentArt Grid触发和处理服务器端事件 ComponentArt Grid的一个重要特征是它能够触发服务器端事件.为了充分发挥他的优势,适当的响应这些事件是至关重要的.这篇文章提供了 ...

最新文章

  1. NFS服务器设置及mount命令挂载
  2. CodeForces - 628D Magic Numbers(数位dp)
  3. 聊聊 computed 影响性能的场景
  4. STM32 J-LINK、ST-Link、CMSIS-DAP
  5. mysql必知必会的数据_MySQL必知必会---数据过滤
  6. 工程师职业发展的四个阶段
  7. 电商后台管理系统——JavaWeb项目 毕业设计论文
  8. 计算机关机怎么按,按什么键电脑关机
  9. python中e怎么计算_蒙特卡洛法计算自然常数e——python编程及可视化
  10. MS project中的完成百分比、工时完成百分比和实际完成百分比
  11. 随机过程4-宽平稳过程,严平稳过程的定义和判定
  12. Vivado综合设置之-gated_clock_conversion
  13. 面了个腾讯拿28k跳槽出来的,真正见识到了跳槽天花板
  14. Android 2.3 Gingerbreader 正式发布,向游戏开发者献媚
  15. maya2018英文翻译_maya2018英文怎么切换中文?
  16. 单词 ----- part8
  17. 《信号与系统》实验-使用 MATLAB 进行生成数字音乐、生成乐器音乐、音乐处理与添加音乐特效(题目)
  18. 004:AWS数据湖解决方案
  19. 小程序毕业设计 基于微信美食介绍点评小程序毕业设计开题报告功能参考
  20. 如何报名拼多多官方活动?万顿思电商

热门文章

  1. Android性能优化之启动优化实战篇,最终入职阿里
  2. 【深度学习】keras框架使用预训练模型进行Finetune的应用
  3. 7-1 堆栈操作合法性(20 分)
  4. linux容器怎么运行到windows,如何在 Windows 上运行 Linux 容器?
  5. php cookie删除不了,php cookie删除不了怎么办
  6. synchronized不能锁静态变量_多线程编程不可错过——彻底理解synchronized
  7. 网站输入正确账号密码页面刷新一下_Folx的密码管理保存网站登陆信息
  8. 浅析影响网站建设的因素有哪些?
  9. 如何开始企业网站的需求分析?
  10. html制作滚动游戏,HTML标签marquee实现滚动效果的简单方法(必看)