kendo grid 自定义编辑求助

findit 2017-09-18 10:04:40
自定义的grid数据多筛选框编辑,失去焦点后值就变成object,求大神指点

var$grid = $("#ProductSysFlowShareGrid");
//console.log($grid);
if($grid.data('kendoGrid')) {
// 如果已存在kendoGrid实例,则将其销毁,重新建一个
$grid.data('kendoGrid').destroy();
}


$grid.kendoGrid({
dataSource: flowsharedataSource,
pageable: true,
//height: 550,
width: "300px",
toolbar: ["create"],
columns: [
{ field:"shrprdFlow", title: "flwprdFlow",hidden:true },
{ field: "shrprdStaff", title:"姓名", width: "120px",editor: staffDropDownEditor,template:"#=shrprdStaff#"},
{ field: "shrprdTlid", title:"产品号", format: "{0:c}", width: "120px",hidden:true },
{ field: "shrprdRatio", title:"分润比率", width: "120px"},
{ command: ["edit", "destroy"], title: " ", width: "150px"}],
editable: true
});

console.log(flowsharedataSource);


//自动填充数据源
varstaffSource=newkendo.data.DataSource({
transport:{
read:{
dataType:"json",
url:"/kh/manage/findSharestaffByOrgid.action",
id:"id",
cache : false,
shrprdStaff:"shrprdStaff",
// staffid:"id",
data:{orgid:"530001140"}
}
}
});
staffSource.read("530001140");
console.log(staffSource);
//多项填充
kendo.ui.plugin(kendo.ui.ComboBox.extend({

options: {

name: "MultiFilterComboBox"

},

_filterSource: function() {

this.dataSource.filter({

logic: "or",

filters: [

{ field: "realName",operator: "contains", value:this.text()},

{ field: "pyname",operator: "contains", value:this.text()}, //拼音全拼

{ field: "pyjxname",operator: "contains", value: this.text()},//拼音简写

{ field: "desp",operator: "contains", value: this.text()},//身份证号

{ field: "id",operator: "contains", value: this.text()}//员工号

]

});

}

}));




functionstaffDropDownEditor(container, options) {
varinput= $('<input required name="shrprdStaff" />');
input.appendTo(container);
input.kendoMultiFilterComboBox({
dataSource:staffSource,
filter: 'contains',
placeholder: '请输入身份证号或姓名',
minLength:2,
highlightFirst:true,
delay:300,
height:300,
width:300,
template: function(item) {
//console.log(item.realName);shrprdStaff

return item.shrprdStaff;//+ "-" + item.id ;
},
valuePrimitive:true,
dataTextField:"shrprdStaff",
dataValueFiled:"id"
});


}
...全文
149 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

87,990

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧