Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3286142
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:20:48+00:00 2026-05-17T20:20:48+00:00

I’ve got a jqgrid (version 3.5.3) on my site which gets its results from

  • 0

I’ve got a jqgrid (version 3.5.3) on my site which gets its results from an ajax call to a web service. Often the query is complicated and it takes a few seconds to load the result. While it is loading the user sees a box [Loading…].

In case the users realise they’re searching for the wrong thing, the client has asked to add a cancel button to the grid, which would:

  1. make the grid forget about the data it’s just requested
  2. retain the results already loaded from the previous search

There doesn’t seem to be anything built in for this, so I’m probably looking for a bit of a hack to achieve this.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T20:20:49+00:00Added an answer on May 17, 2026 at 8:20 pm

    Here’s our solution, which is very similar to Oleg’s, the main difference is that we keep track of a list of XHRs to make sure we clean all requests up

    var handlerUrl = '';
    
    jQuery(document).ready(function() {
        var xhrList = [];
    
        var beforeSendHandler = function() {
    
            var cancelPendingRequests = function() {
                jQuery.each(xhrList, function() { this.abort(); });
                xhrList = [];
                return false;
            };
    
            var hideLoadingUI = function() {
                $(this).hide();
                $("#load_list").hide();
            };
    
            cancelPendingRequests();
    
            $("#load_list").show();
    
    // some faffing around to ensure we only show one cancel button at a time
            if (jQuery("#cancelrequest").length == 0) {
                jQuery(".ui-jqgrid-titlebar").append(jQuery("<button   id='cancelrequest'>Cancel</button>").click(cancelPendingRequests).click(hideLoadingUI));
            } else {
                jQuery("#cancelrequest").show();
            };  
        }
    
    
        jQuery("#list").jqGrid({
            datatype: function(postdata) {
    
                GetSearchCriteria(); //needed for the grid's filtering
    
                var xhr = $.ajax({
                    //we override the beforeSend so we can get at the XHRs, but this means we have to implement the default behaviour, like showing the loading message ourselves
                    beforeSend: beforeSendHandler,
                    dataType: "xml",
                    data: postdata,
                    success: function(xmlDoc) {
                        //
                        jQuery("#cancelrequest").hide();
                        $("#load_list").hide();
                        jQuery("#list")[0].addXmlData(xmlDoc);
                        xhrList = [];
                    }
    

    …

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I've got a string that has curly quotes in it. I'd like to replace
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.