This is a migrated thread and some comments may be shown as answers.

Combobox AngularJS ng-model binding issue

2 Answers 425 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Harlan
Top achievements
Rank 1
Harlan asked on 24 Nov 2015, 05:34 PM

I have two comboboxes on the same app view. One works properly and the other one doesn't.

 The issue is that the workOrderType combo isn't showing the selected/existing value that's already in the object source. The selections are in the dropdown/combo correctly, but when it loads it shows only the placeholder.

Below is my relevant code. I'm omitting the part that loads the original item. When I do a  pause on the javascript, I can see that detail.WorkOrderTypeId does have a correct value. Any ideas what might be causing this?

 

$scope.statusComboOptions = {
    dataSource: new kendo.data.DataSource({
        data: []
    }),
    placeholder: "Select a Status",
    filter: "startswith",
    dataTextField: "Description",
    dataValueField: "Id"
}
 
$scope.workOrderTypeComboOptions = {
    dataSource: new kendo.data.DataSource({
        data: []
    }),
    placeholder: "Select a Work Order Type",
    filter: "startswith",
    dataTextField: "Description",
    dataValueField: "Id"
}
 
var asyncPromises = [];
 
asyncPromises.push(workOrdersService.getStatuses().then(function (data) {
    $scope.statusComboOptions.dataSource.data(data);
}));
 
asyncPromises.push(workOrdersService.getWorkOrderTypes().then(function (data) {
    $scope.workOrderTypeComboOptions.dataSource.data(data);
}));
 
$q.all(asyncPromises).then(function () {
    $scope.asyncResolved = true;
});
 

 

<div class="control-group">
    <label>Status</label>
    <select kendo-combo-box
            k-options="statusComboOptions"
            ng-model="detail.StatusId"
            k-ng-delay="asyncResolved"></select>
</div>
<div class="control-group">
    <label>Work Order Type</label>
    <select kendo-combo-box
            k-options="workOrderTypeComboOptions"
            ng-model="detail.WorKOrderTypeId"
            k-ng-delay="asyncResolved"></select>
</div>

2 Answers, 1 is accepted

Sort by
0
Harlan
Top achievements
Rank 1
answered on 24 Nov 2015, 06:44 PM

Looks like I posted too soon. The issue was a typo in the ng-model="detail.WorKOrderTypeId". It should not have had a capital K in the WorK.

0
Alex
Top achievements
Rank 1
answered on 23 Jan 2018, 09:45 AM
Thanks
Tags
ComboBox
Asked by
Harlan
Top achievements
Rank 1
Answers by
Harlan
Top achievements
Rank 1
Alex
Top achievements
Rank 1
Share this question
or