Print "Processing" Problem

Print "Processing" Problem

ScottGScottG Posts: 3Questions: 0Answers: 0
edited September 2010 in TableTools
I noticed Rob posted on this back on Jun 18th, 2009 but I couldn't find a response/fix for it and was wondering if anyone knew about this problem and how to solve it.

When I go to print the print view comes up and works just fine, but after pressing ESC to return to the grid, the "processing" alert doesn't disappear. I can turn off processing on the table to make it disappear, but I would like it to process on the initial queries for the table. Also, if the table is sorted/searched when the "processing" is stuck on the table it removes the "processing" alert. Is this a bug or am I doing something wrong and how can I fix it?

Replies

  • ScottGScottG Posts: 3Questions: 0Answers: 0
    edited September 2010
    [code]function fnPrintEnd(e) {
    /* Only interested in the escape key */
    if (e.keyCode == 27) {
    /* Show all hidden nodes */
    fnPrintShowNodes();

    /* Restore the scroll */
    window.scrollTo(0, _iPrintScroll);

    /* Drop the print message */
    if (_nPrintMessage) {
    document.body.removeChild(_nPrintMessage);
    _nPrintMessage = null;
    }

    console.log("in print end");

    /* Restore the table length */
    _DTSettings._iDisplayStart = _iPrintSaveStart;
    _DTSettings._iDisplayLength = _iPrintSaveLength;
    _DTSettings.oApi._fnCalculateEnd(_DTSettings);
    _DTSettings.oApi._fnProcessingDisplay(_DTSettings, false);
    _DTSettings.oApi._fnDraw(_DTSettings);

    $(document).unbind("keydown", fnPrintEnd);
    }
    }
    [/code]

    Adding _DTSettings.oApi._fnProcessingDisplay(_DTSettings, false); stops it from processing on tables that are processed client-side, but since it is added for the _fnDraw when the server-side processes are called the processing is reinitilized to true and processing will show up for those until the server returns information.
  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    I think there also needs to be a "e.preventDefault();" in there - particularly in Firefox, as the esc key will cancel all network connection - including the XHR which has been kicked off by the esc key... Does this sound like what you might be seeing?

    Allan
  • ScottGScottG Posts: 3Questions: 0Answers: 0
    The XHR isn't being cancelled. This code works for me for both server-side and client-side processing. The only downside is for the client-side processing because with this code when esc is pressed to leave the printing view, processing will not reappear (even though there isn't any long processing that is done).
This discussion has been closed.