Firefox w/ Load on Demand causing error when thread aborted

4 posts, 0 answers
  1. James
    James avatar
    35 posts
    Member since:
    Apr 2010

    Posted 22 Jun 2010 Link to this post

    We have a RadComboBox that is being loaded on demand with values as the user types (similar to the search assist with a google web search). 

    When a user hits enter or clicks a button to perform their search while the data is still being loaded, we are getting a modal error message window in Firefox  that states: "The server method 'GetCompletionList' failed."  'GetCompletionList' is the name of our webservice method.  This only happens in Firefox and only happens when the ajax request to load data is aborted.

    We attempted to cancel the OnClientItemsRequestFailed event of the combo box but found the event was not being raised in this case.

    Our combo box is in a user control on a master page.  Here is the code for the combo:
    <telerik:RadComboBox ID="ddlTextSearch" runat="server" AllowCustomText="True" EnableLoadOnDemand="True"   
    ShowDropDownOnTextboxClick="False" ShowToggleImage="False" onclientitemsrequesting="ddlTextSearch_ItemRequesting"  OnClientSelectedIndexChanged="ddlTextSearch_SelectionChanged" ZIndex="9900">  
            <WebServiceSettings Method="GetCompletionList" Path="~/TextSearchAutoComplete.aspx" /> 
    </telerik:RadComboBox> 

    Here is the js we are using:
    function ddlTextSearch_HandleKeyPress(e)   
            {  
                if (!e) e = event;  
                      
                var keyCode = e.keyCode || e.which;  
                if (keyCode == 13)   
                {  
                    var combo = $find("<%= ddlTextSearch.ClientID %>");  
                    var ajaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>");  
                    if (combo && combo.get_highlightedItem() != null)  
                    {  
                        ajaxManager.ajaxRequestWithTarget("<%= ddlTextSearch.UniqueID %>","<%= WebUtils.HttpRequestEventArguments.SearchAssist %>");  
                    }  
                    else  
                    {  
                        ajaxManager.ajaxRequestWithTarget("<%= ddlTextSearch.UniqueID %>","<%= WebUtils.HttpRequestEventArguments.Search %>");  
                    }  
                }  
            }  
            
            // Telerik workaround for enter key when ddl is loading.  
            var $ = $telerik.$;     
            $(document).ready(function(){$("#" + "<%= ddlTextSearch.ClientID %>" + "_Input").keydown(ddlTextSearch_HandleKeyPress);});  
            
            // Telerik workaround for not selecting cell text when clicking on txtbox.  
            Telerik.Web.UI.RadComboBox.prototype._onInputCellClick = function(e)   
                {  
                    if (this._enabled) {  
                        //  if (this.get_text() !== this.get_emptyMessage())  
                        //       this.selectText(0, this.get_text().length);  
                        if (!this.get_dropDownVisible() && this._showDropDownOnTextboxClick)  
                            this._showDropDown(e);  
                        return true;  
                    }  
                }  
                  
            function ddlTextSearch_SelectionChanged(sender, eventArgs)  
            {  
                if (eventArgs.get_domEvent().type == "click")  
                {  
                    var ajaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>");  
                    if (ajaxManager)  
                    {  
                      ajaxManager.ajaxRequestWithTarget("<%= ddlTextSearch.UniqueID %>","<%= WebUtils.HttpRequestEventArguments.SearchAssist %>");  
                    }  
                }  
            }  
              
           function ddlTextSearch_ItemRequesting(sender, eventArgs)  
            {  
                var context = eventArgs.get_context();  
                /* Setting a few context parameters - code removed */ 
            } 



    Can you please provide a work around or solution?  Thanks.
  2. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 24 Jun 2010 Link to this post

    Hello James,

    We resolved this issue some time ago.

    Could you please let me know the exact version of Telerik.Web.UI that you are using?

    Sincerely yours,
    Simon
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. James
    James avatar
    35 posts
    Member since:
    Apr 2010

    Posted 24 Jun 2010 Link to this post

    Version: 2010.1.519.35
  4. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 29 Jun 2010 Link to this post

    Hi James,

    Thank you for confirming this.

    Indeed we have fixed this issue when it is caused by the RadComboBox itself.

    However in your code you are initiating an AJAX request (with the RadAjaxManager) when the 'Enter' key is pressed. If this happens while the RCB is loading its Items, the error appears (which is essentially the issue).

    Now, one way to resolve this is to cancel the AJAX request if the RCB is in the middle of a request for Items. You can verify this in this way:
    function ddlTextSearch_HandleKeyPress(e)  
        if (!e) e = event; 
               
        var keyCode = e.keyCode || e.which; 
        if (keyCode == 13)  
        
            var combo = $find("<%= ddlTextSearch.ClientID %>"); 
            if (!combo._ajaxRequest)
            {
                var ajaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>"); 
                if (combo && combo.get_highlightedItem() != null
                
                    ajaxManager.ajaxRequestWithTarget("<%= ddlTextSearch.UniqueID %>","<%= WebUtils.HttpRequestEventArguments.SearchAssist %>"); 
                
                else 
                
                    ajaxManager.ajaxRequestWithTarget("<%= ddlTextSearch.UniqueID %>","<%= WebUtils.HttpRequestEventArguments.Search %>"); 
                
            }
        
    }

    Best wishes,
    Simon
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top