【发布时间】:2015-07-23 16:51:00
【问题描述】:
我尝试在 Kendo UI 中设置自定义下拉菜单。
我有一个关于我的问题的参考。
http://dojo.telerik.com/aFIZa/13
我的问题是我不知道如何在模板属性中设置选定的文本?我想显示文本字段,但将 id 保存为值。 而且我不想使用外部数据源。我希望它在 json 中作为内联。
代码如下:
$scope.mainGridOptions = {
dataSource: $scope.dataSource,
pageable: true,
height: 550,
toolbar: ["create"],
columns: [
{ field: "Category", title: "Category", width: "180px",
editor: function(container, options) {
var editor = $('<input kendo-drop-down-list required k-data-text-field="\'cat\'" k-data-value-field="\'id\'" k-data-source="{data:[{id: 1, cat: \'test\'}, {id: 2, cat: \'test2\'}]}" data-bind="value:Category"/>')
.appendTo(container);
$compile(editor)($scope);
editor.css("visibility", "visible");
}
, template:"selected text in the combo "
}
], editable: true
}
【问题讨论】:
标签: angularjs binding kendo-ui telerik kendo-grid