kendoUI下拉框
来源:互联网 发布:青岛易亚网络骗局 编辑:程序博客网 时间:2024/06/05 19:59
kendoUI下拉框之固定值选项:
在$("#demo_grid").kendoGrid的columns中设置属性“isEnable”是固定值为“Yes”/“No”的下拉列表:
{
field: "isEnable",
/*title: "<fmt:messagekey="p.message.isEnable"/>",此处标题设置国际化*/
title: "isEnable",
attributes: {style: "font-size: 15px"},
template: function(dataItem) {
var value = dataItem.isEnable;
if(value === "Y"){
return "Yes";
}else if(value === "N"){
return "No";
}else{
return "";
}
},
editor: function(container,options){
$('<input name="'+options.field+'"/>')
.appendTo(container)
.kendoDropDownList({
dataTextField: "is_enableText",
dataValueField: "is_enableValue",
valuePrimitive: true,
dataSource: [
{is_enableText: "Yes", is_enableValue: "Y"},
{is_enableText: "No", is_enableValue: "N" }
]
});
}
}
kendoUI下拉框之获取值选项及如何设置kendoUI下拉框中的默认值:
同样的,在$("#demo_grid").kendoGrid的columns中设置属性“Rate”的值来自后台url"/getRate"(此链接返回的是一个对象列表,以对象的形式将属性“Rate”值封装起来传输过来)中数据的下拉列表:
{
field: "Rate", title: "rate", attributes: {style: "font-size: 15px"}, width:"115px", template: function(dataItem) {
if(dataItem != null){
return dataItem.tier1RatePlan;
}
},
editor: function(container,options){
$('<input name="'+options.field+'"/>')
.appendTo(container)
.kendoDropDownList({
dataTextField: "ratePlan",
dataValueField: "ratePlan",//ratePlan:对应此“/getRate”返回对象的一个属性名
valuePrimitive: true,
autoBind:true,
dataSource: {
transport: {
read: "/getPlan",
dataType: "json"
}
},
//添加的时候下拉表默认选择一个
dataBound: function(e){
if (this.select() === -1) { //check whether any item is selected
this.select(0);
this.trigger("change");//真实有效的获取到这个值(而非仅仅显示出来)
}
}
});
}
},
在schema之前可通过添加requestStart或requestEnd来控制在执行每个operation("read"/"create"/"update"/"destroy"...)之前或之后做点什么。例如,在执行非read操作结束时,demoGrid中的数据进行一次read操作即每进行一次操作之后都read重新读取一遍(等于是刷新一遍):
requestEnd: function(e){
if(e.type != "read"){
demoGrid.data("kendoGrid").dataSource.read();
}
},
阅读全文
1 0
- KendoUI 下拉框验证
- kendoUI下拉框
- KendoUI treeList popup 里添加下拉框 DropdownList 只向服务器传ID
- KendoUI系列:MultiSelect 多选 智能下拉
- kendoui布局
- kendoui - 片段
- kendoui笔记
- KendoUI使用指南
- 认识KendoUI
- KendoUI —— 关于 KendoUI
- KendoUI 如何布局页面
- KendoUI Mobile 动画效果
- kendoUI如何刷新数据源
- ofbiz-kendoui-grid
- ofbiz-kendoUI-dropDownList
- KendoUI MVVM用法
- kendoui 基础教程分享
- KendoUI学习笔记
- 【Web】CSS3 一些tips总结
- MYSQL 导入与导出数据库
- json字符串和xml互转
- JS继承与原型链
- percona-toolkit-2.2.2.tar.gz安装报错
- kendoUI下拉框
- 自定义泛型Java
- Java求矩形面积和圆形面积的异常处理实例
- (转)最新谷歌浏览器无法启用扩展程序问题
- Js调用ocx中的出参为BSTR* 的问题。
- c++返回类型协变
- android studio中乱码各种情况的解决办法
- eclipse3.7 安装spring tool suite
- python中的三个读read(),readline()和readlines()