我试图用来自服务器的数据填充我的kendo-combo-box,但是无法正常工作..这是我的情况:
因此,当我尝试从服务器获取id值并使用ng-model将它们放入时,第一个组合框正常工作,但其他组合框不会自动选择值。这是我的代码HTML:
<div class="row">
<div class="col-md-6">
<div class="form-group has-feedback" ng-class="{ 'has-error': DataForm.coordinator.$invalid, 'has-success': !DataForm.coordinator.$invalid }">
<label class="control-label">Coordinator</label>
<br />
<select kendo-combo-box
name="coordinator"
k-placeholder="'Select a coordinator'"
k-data-text-field="'Name'"
k-data-value-field="'Id'"
k-filter="'contains'"
k-auto-bind="false"
k-min-length="3"
k-data-source="coordinators"
ng-model="item.IdUserCoordinator"
style="width: 100%" required></select>
</div>
</div>
<div class="col-md-6">
<div class="form-group has-feedback" ng-class="{ 'has-error': DataForm.sendto.$invalid, 'has-success': !DataForm.sendto.$invalid }">
<label class="control-label">Send To</label>
<br />
<select kendo-combo-box
name="sendto"
k-placeholder="'Select a user'"
k-data-text-field="'Nome'"
k-data-value-field="'Id'"
k-filter="'contains'"
k-auto-bind="false"
k-min-length="3"
k-data-source="responsible"
ng-model="item.IdUserResponsible"
style="width: 100%" required></select>
</div>
</div>
</div>
这是我的剧本:
then(function (data) {
//I have more code here data[0] and data [1]
$scope.coordinators = new kendo.data.DataSource();
$scope.responsible = new kendo.data.DataSource();
$scope.coordinators.data(data[2]);
$scope.responsible.data(data[2]);
var response = RPC.obj.get({ id: $scope.id }); //Get my object from the server
response.$promise.then(function (data) {
$scope.item = data;
});
}
谢谢!
答案 0 :(得分:1)
我发现 - 它缺少属性k-auto-bind =“true”。