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

WebServiceSettings delay issue / handling of requests in order

3 Answers 114 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 14 Nov 2013, 11:20 AM
I've noticed the behaviour, for example, of a RadAutoCompleteBox when using WebServiceSettings, that occasionally the responses from the server do not return in the same order they were requested by the client, which makes for confusing the user as entries displayed in the drop-down do not always make sense according to what has been typed.

This raises two questions:

  1. Is there a delay property on RadAutoCompleteBox/RadSearchBox etc to delay the client request by n milliseconds until the user has stopped typing, instead of firing back several requests as the user types something?
  2. Can the RadAutoCompleteBox/RadSearchBox etc (e.g. via time-stamping client requests to the server or other way) always ensure that responses from the server are ignored unless the response was the last one to be made?

Hope this makes sense!

3 Answers, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 19 Nov 2013, 11:48 AM
Hello Steve,

You could use the _requestDelay method of the RadAutoCompleBox, in order to achieve the desired functionality. Please consider using the OnClientLoad client-side event of the control in the following manner:

function OnClientLoad(sender) {
           sender._requestDelay = 3000;
       }

Regards,
Nencho
Telerik
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.
0
Steve
Top achievements
Rank 1
answered on 19 Nov 2013, 12:29 PM
This seems to have no effect. I am using Telerik.Web.UI.dll 2013.2.717.40 

The code below does not produce any delay in the client request, the client function onClientPickerRequesting is fired immediately once there is a key press in the RadAutoCompleteBox. The client function onClientLoad is called OK and there is no error thrown. 



<telerik:RadAutoCompleteBox ID="RadAutoCompleteBox1" Runat="server"  OnClientLoad="onClientLoad" OnClientRequesting="onClientRequesting" >
    <ClientDropDownItemTemplate>
        #= Text#
    </ClientDropDownItemTemplate>
    <WebServiceSettings Path="~/Service.asmx"  Method="GetPickerResults" ></WebServiceSettings>
</telerik:RadAutoCompleteBox>


function onClientLoad(sender) {
sender._requestDelay = 3000;
alert("onClientLoad called OK.");
}
function onClientRequesting(sender, args) {
  alert("Requesting....");
}
0
Nencho
Telerik team
answered on 22 Nov 2013, 09:42 AM
Hello Steve,

The suggested property was not yet introduced in the version that you are using. Therefore, I would suggest you to overwrite the function responsible for the ClientRequesting. Please consider the following implementation, with just configuring the timeout:
<script type="text/javascript">
        Telerik.Web.UI.RadAutoCompleteBox.prototype.query = function (searchString) {
            var me = this;
            searchString = searchString || this.get_searchString();
            if (this._requestInProgress)
                clearTimeout(this._requestInProgress);
 
            if (!searchString) {
                this.clear();
            } else {
                this._requestInProgress = setTimeout(function () {
                    if (me.get_webServiceSettings())
                        me._doLoadOnDemandFromWebService(searchString);
                    else if (me.get_bindingMode() === Telerik.Web.UI.RadAutoCompleteBinding.OData)
                        me._doLoadOnDemandUsingOData(searchString);
                    else
                        me._doLoadOnDemand(searchString);
                }, 2000);
            }
        }
    </script>


Regards,
Nencho
Telerik
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.
Tags
General Discussions
Asked by
Steve
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Steve
Top achievements
Rank 1
Share this question
or