Can't open AutoComplete popup manually

3 posts, 0 answers
  1. Prokhor
    Prokhor avatar
    2 posts
    Member since:
    Mar 2015

    Posted 07 Mar 2015 Link to this post

    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. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 11 Mar 2015 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. Prokhor
    Prokhor avatar
    2 posts
    Member since:
    Mar 2015

    Posted 11 Mar 2015 in reply to Atanas Korchev Link to this post

    Thank you. I've missed part of the given example
Back to Top