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

Can't open AutoComplete popup manually

2 Answers 365 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
Prokhor
Top achievements
Rank 1
Prokhor asked on 07 Mar 2015, 01:31 PM
Hello. I'm trying to use "No records found" example (from here) but popup with no-data-found-msg is closing each second time.
Where is the problem in my code?

$scope.AutoCompleteOptions = {
        dataTextField: "No",
        filter: "contains",
        minLength: 1,
        ignoreCase: true,
        highlightFirst: true,
        headerTemplate: '<span id="no-data-found-msg"><b>Бюллетень не найден</b></span>',
        dataBound: function () {
            var noItems = this.list.find("#no-data-found-msg");
            debugger;
            if (!this.dataSource.view()[0]) {
                noItems.show();
                this.popup.open();
            } else {
                noItems.hide();
            }
        },
        dataSource: {
            type: "odata",
            serverFiltering: true,
            transport: {
                read: {
                    url: getBulletinsUrl,
                    dataType: "json",
                    method: "GET"
                },
                parameterMap: function (data, type) {
                    return {
                        filter: $scope.editingGroup.BulletinNo
                    };
                }
            },
            schema: {
                data: function (data) {
                    return data;
                },
                total: function (data) {
                    return data['odata.count'];
                },
                model: {
                    id: "ID",
                    fields: {
                        ID: {
                            editable: false,
                            nullable: true
                        },
                        No: {
                            type: "string"
                        }
                    }
                }
            }
        },
        select: function(e) {
            var dataItem = this.dataItem(e.item.index());
            $scope.editingGroup.BulletinId = dataItem.ID;
        },
        change: function () {
            var found = false;
            var value = this.value();
            var data = this.dataSource.view();
 
            for (var idx = 0, length = data.length; idx < length; idx++) {
                if (data[idx] === value) {
                    found = true;
                    break;
                }
            }
 
            if (!found) {
                this.value("");
            }
        }
    };

2 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 11 Mar 2015, 06:59 AM

Hello Prokhor,

Here is a demo which seems to work as expected: http://dojo.telerik.com/@korchev/eZavi

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Prokhor
Top achievements
Rank 1
answered on 11 Mar 2015, 08:12 AM
Thank you. I've missed part of the given example
Tags
AutoComplete
Asked by
Prokhor
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Prokhor
Top achievements
Rank 1
Share this question
or