Filter does not work when Clearing the text and selection in Client Side

3 posts, 0 answers
  1. Kevin
    Kevin avatar
    1 posts
    Member since:
    Mar 2016

    Posted 27 Apr 2016 Link to this post

    I am using the RadComboBox with "Contains" filter. The filter does not work properly when clearing the text and selection in the client side script.

    C# code:

                _comboBox.Filter = RadComboBoxFilter.Contains;

                if (_comboBox.EnableLoadOnDemand && !AllowCustomText && !_comboBox.CheckBoxes)
                    if (String.IsNullOrEmpty(_comboBox.OnClientBlur))
                        _comboBox.OnClientBlur = "function (sender, eventArgs) { var textInTheCombo = sender.get_text(); var item = sender.findItemByText(textInTheCombo); if(!item) { sender.set_text(''); sender.clearSelection(); } }";

    Out intent for OnClientBlur is to clear the user input when it losts the focus and there is not a match item. It does clear the text/selection, and show the EmptyMessage, but when it get the focus again, the combobox still show the filtered items which was filtered by the previous input.


    For example, the combobox has 20 items total. When user inputs a filter and 3 (out of 20) of the items which contains the input characters will show. When user click off the combobox, it clear the text as expected (as none of the items match the input exactly). But when user clicks the combobox again, it still only show the 3 items (instead of the 20 items which is supposed to have as at the moment the text is empty).

    Any suggestions to fix the problem I am getting. Thanks a lot.


    Kevin Hu

  2. Kevin
    Kevin avatar
    2 posts
    Member since:
    Sep 2014

    Posted 28 Apr 2016 Link to this post

    I fixed it finally.

    at the end of the OnClientBlur event script, I added two lines

    _combobox._filterText = "";

    and _combobox.requestItems();

  3. Dimitar
    Dimitar avatar
    359 posts

    Posted 29 Apr 2016 Link to this post

    Hello Kevin,

    Thank you for sharing your solution with the community.

    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top