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

HTML Body Tag gets style display:none if autosuggest is turned off

1 Answer 34 Views
AutoComplete
This is a migrated thread and some comments may be shown as answers.
haider
Top achievements
Rank 1
haider asked on 24 Apr 2015, 10:47 AM

I am getting strange behavior when I turned off the autosuggest programmatically. 

The scenario is that I have a  KendoAutoComplete input box along with search button. The search result come from both typing characters and pressing the search button. The requirement is that autosuggest should work when user has type at least 3 characters in the input, but the search button should open autosuggest even if one character is typed.

 

In order to do that I used the following code below: 

var turnOffAutoComplete = function () {
        autocomplete.options.suggest = false;
        autocomplete.bind("open", function (e) {
            e.preventDefault();            
        });        
    };

    var turnOnAutoComplete = function () {
        autocomplete.unbind("open");
        autocomplete.options.suggest = true;        
    };

 

$("#input_text").keyup(function () {       
        if ($(this).val().length >= 3) {
            turnOnAutoComplete();
        }
        else {
            turnOffAutoComplete();
        }
    });

$("#search-button").click(function () {
        turnOnAutoComplete();
        var val = $('#input_text').val();        
        autocomplete.search(val);
    });

 

The code above is causing the screen to becomes blank when user clicks anywhere on the screen after typing one character (autosuggest data is being fetchedfor first time). I checked in console, and saw <body> having style "display:none". 

Anyone knows why this would be happening? Need help asap. 

 

1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 28 Apr 2015, 08:44 AM
Hello haider,

I am not exactly sure how to reproduce this scenario, however I would suggest a slightly different approach. For example, changing the options should be done using the setOptions method. Also, you can programmatically open the popup through the suggest method. In case that does not helps I would ask you to share a Dojo example where this behavior is observed - that would allow us to investigate further.

Regards,
Alexander Popov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
AutoComplete
Asked by
haider
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or