GetRelationships
在JS脚本中,使用以下代码:
function GetRelationships(container, options) {
$('<input data-text-field="RelationValue" data-value-field="RelationId" data-bind="value:' + options.field + '"/>')
.appendTo(container)
.kendoDropDownList({
dataTextField: "RelationValue",
dataValueField: "RelationId",
value: options.model.RelationId, // THIS IS THE CHANGE I MADE
dataSource: {
transport: {
read: {
dataType: "jsonp",
url: "http://localhost:55719//HouseholdMembers/_GetRelationships",
}
}
},
change: function (e) {
var dataItem = e.sender.dataItem();
options.model.set("Relationship", dataItem.RelationValue);
}
});
}
为了便于参考,我创建了用于网格内联编辑的工作DOJO,其中下拉菜单作为编辑器。你可以在这里找到小提琴
Inline Grid Editing with Dropdown As editor template
如果这不起作用,请告诉我。否则,请不要忘记将其标记为已接受的解决方案。