Skip to content Skip to sidebar Skip to footer

How To Bind Foreign Key Kendo Ui Dropdownlist (with Angular)

I am working with kendo UI and angular grid application. My grid is populated from JSON data (separate file) and I am use angular service: My JSON data: [ { 'Id': 1, 'AccountNo': '

Solution 1:

For solve that problem I use hardCoded variable:

$scope.documentTypeDS = [
  { "value": 1, "text": "doc 1" },
  { "value": 2, "text": "doc 2" },
  { "value": 3, "text": "doc 3" },
  { "value": 4, "text": "doc 4" },
  { "value": 5, "text": "doc 5" },
  { "value": 6, "text": "doc 6" }
];

And modified definition for my gridMaster. In gridMaster column property I insert:

{ field:"DocumentTypeId", hidden:true, values:$scope.documentTypeDS },

And, In HTML i modified code lines, from this:

<select  kendo-drop-down-list
                                         class="k-dropdownField" k-options="documentType"
                                         ng-model="documentTypeId" ng-bind="documentTypeId"></select>

to this:

<input kendo-drop-down-list k-data-text-field="'text'" k-data-value-field="'value'" data-bind="value:documentTypeId"class="k-dropdownField" k-data-source="documentType" ng-readonly="isReadonly" ng-model="documentTypeId" />

I suppose that there is a better solution of this, because I use hardCoded part of code for define $scope.documentTypeDS.

Post a Comment for "How To Bind Foreign Key Kendo Ui Dropdownlist (with Angular)"