[英]Kendo Grid : Default value 1 in cell in inline edit mode, how to change it?
I have following config foo column in grid: 我在网格中有以下config foo列:
field: 领域:
actionName: {
editable: true,
nullable: true,
defaultValue: {"name" : "TEST123"},
type: "object"
},
Column: 柱:
{
field :"actionName",
title : $translate.instant('ACTIONNAME'),
width: "200px",
editor: GlobalHelperService.getActionNamesListForAutocomplete,
template: '#: data.actionName.name #',
filterable: { cell: { operator:"contains"
}
}
},
Which works almost fine, but if i clicked on cell item i always got following value (see. image below), instead of the text defined in template attribute. 这几乎可以正常工作,但是如果我单击单元格项目,我总是得到以下值(参见下图),而不是模板属性中定义的文本。
How can i solve it please? 我该如何解决?
Many thanks for any advice. 非常感谢您的任何建议。
It might not be the cleanest way, but you could use the edit
event like I do in this blog post . 这可能不是最干净的方法,但是您可以像在本博文中一样使用edit
事件。
$("#grid").kendoGrid({
edit: onEdit
});
function onEdit(editEvent) {
// Ignore edits of existing rows.
if(!editEvent.model.isNew()) { return; }
editEvent.model.set("actionName", {name: "TEST123"});
}
Although as I note in that post, setting the default value with .set()
might not work in this case, and you might need to edit the text in the edit box directly: 尽管正如我在.set()
文章中指出的那样,在这种情况下,使用.set()
设置默认值可能不起作用,并且您可能需要直接在编辑框中编辑文本:
editEvent.container
.find("[name=actionName]")
.val("TEST123")
.trigger("change");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.