Combobox AngularJS ng-model binding issue

2 posts, 0 answers
  1. Harlan
    Harlan avatar
    19 posts
    Member since:
    Dec 2014

    Posted 24 Nov 2015 Link to this post

    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. Harlan
    Harlan avatar
    19 posts
    Member since:
    Dec 2014

    Posted 24 Nov 2015 in reply to Harlan Link to this post

    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.

  3. Kendo UI is VS 2017 Ready
Back to Top