Israel Saraiva
Israel Saraiva

Reputation: 155

kendo-combo-box with angularjs

I'm trying to populate my kendo-combo-box with data from server, but is not working.. Here is my situation:

So, when i try to get the id values from the server and put on them using ng-model, the first combo-box works normally, but the others are not selecting the value automatically. Here is my code 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>

Here is my script:

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

Thanks!!

Upvotes: 2

Views: 3750

Answers (1)

Israel Saraiva
Israel Saraiva

Reputation: 155

I discovered-it, the property k-auto-bind="true" was missing.

Upvotes: 3

Related Questions