首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >kendo angular Inline editing下拉列表

kendo angular Inline editing下拉列表
EN

Stack Overflow用户
提问于 2015-09-18 23:16:12
回答 1查看 967关注 0票数 0

我正在使用angular kendo和创建的内联编辑网格,使用这个源代码http://docs.telerik.com/kendo-ui/web/grid/how-to/AngularJS/angular-custom-editor中的代码

只需对函数"$scope.categoryDropDownEditor“进行少量更改即可

代码语言:javascript
运行
复制
$scope.categoryDropDownEditor = function(container, options) {
  var categories = {
                    'Category': [
                        { 'CategoryName': 'Beverages', 'CategoryID': 1 },
                        { 'CategoryName': 'Condiments', 'CategoryID': 2 }
                    ]
                };

        var editor = $('<input kendo-drop-down-list required k-data-text-field="\'CategoryName\'" k-data-value-field="\'CategoryID\'" data-bind="value:' + categories[0].Category.CategoryName + '"/>')
        .appendTo(container);
      }

我想让下拉列表加载我自己的json,它对我不起作用。

EN

回答 1

Stack Overflow用户

发布于 2015-09-27 05:57:06

乍一看,您似乎只需要将类别放在作用域上,然后使用k-data-source在kendo下拉指令标记上引用它们,如下所示……

代码语言:javascript
运行
复制
$scope.categoryDropDownEditor = function(container, options) {
  $scope.categories = {
                    'Category': [
                        { 'CategoryName': 'Beverages', 'CategoryID': 1 },
                        { 'CategoryName': 'Condiments', 'CategoryID': 2 }
                    ]
                };

        var editor = $('<input kendo-drop-down-list required k-data-text-field="\'CategoryName\'" k-data-value-field="\'CategoryID\'" k-data-source="categories.Category" />')
        .appendTo(container);
      }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32655507

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档