OnClientItemsRequesting event for RadDropDownTree

2 posts, 1 answers
  1. Tauqir
    Tauqir avatar
    10 posts
    Member since:
    Jul 2013

    Posted 05 Dec 2013 Link to this post

    I am using the MinFilterLength property for filtering items in the RadDropDownTree. Assume the MinFilterLength property is set to 3.
    If I now enter 3 characters, the results are filtered correctly. However, if I delete a character, the results are not reset.
    How can I achieve this?
    I searched online, and found a possible solution here: http://www.telerik.com/community/forums/aspnet-ajax/combobox/hide-disable-the-loading-text-on-itemsrequested.aspx.
    However, RadDropDownTree does not have a OnClientItemsRequesting event. Which event can I use to achieve the same behavior?

  2. Answer
    Boyan Dimitrov
    Boyan Dimitrov avatar
    2062 posts

    Posted 10 Dec 2013 Link to this post


    Your observations are absolutely correct and we will include a fix for this issue in our upcoming service pack release.  In the meantime you can use this workaround
    //markup code
    <telerik:RadDropDownTree ID="RadDropDownTree1" runat="server" DefaultMessage="Select location" Skin="Default"
           EnableFiltering="true" FilterSettings-Highlight="Matches" FilterSettings-MinFilterLength="3">
    <script type="text/javascript">
               var isBackspacePressed = false;
               function pageLoad() {
                   $find("RadDropDownTree1")._manager._shouldFilter = function (text) {
                       var shouldFilter = ((text.length >= this._minFilterLength || (text == "" && this._minFilterLength == 1)) || isBackspacePressed);
                       isBackspacePressed = false;
                       return shouldFilter;
                   $find("RadDropDownTree1")._manager._onFilterKeyUp = function (e) {
                       var text = e.target.value,
                           key = Sys.UI.Key,
                           keyCode = e.keyCode || e.which;
                       if (keyCode == key.backspace) {
                           isBackspacePressed = true;
                       else {
                           isBackspacePressed = false;
                       switch (keyCode) {
                           case 16: // shift
                           case 17: // ctrl
                           case 18: // alt
                           case key.home:
                           case key.end:
                           case key.enter:
                           case key.tab:
                           case key.left:
                           case key.right:
                           case key.up:
                           case key.down:
                           case key.pageUp:
                           case key.pageDown:
                           case key.esc:

    Boyan Dimitrov
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Back to Top