0
votes

im using angular kendo and created inline editing grid, using the code from this source http://docs.telerik.com/kendo-ui/web/grid/how-to/AngularJS/angular-custom-editor

with few changes in the function "$scope.categoryDropDownEditor"

$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);
      }

i want the drop down list load my own json , it's not working for me .

1

1 Answers

0
votes

At first glance it seems you would just need to put the categories on the scope and then reference them on the kendo drop down directive tag using k-data-source as follows...

$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);
      }