kendo grid 自定义编辑求助
自定义的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"
});
}