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

Firefox w/ Load on Demand causing error when thread aborted

3 Answers 79 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 22 Jun 2010, 06:44 PM
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.

3 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 24 Jun 2010, 01:29 PM
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
0
James
Top achievements
Rank 1
answered on 24 Jun 2010, 04:33 PM
Version: 2010.1.519.35
0
Simon
Telerik team
answered on 29 Jun 2010, 03:55 PM
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
Tags
ComboBox
Asked by
James
Top achievements
Rank 1
Answers by
Simon
Telerik team
James
Top achievements
Rank 1
Share this question
or