Detecting if datatables is busy processing an ajax request

Detecting if datatables is busy processing an ajax request

dazusudazusu Posts: 1Questions: 0Answers: 0
edited March 2014 in DataTables 1.10
Is there a method/bool available which will indicate whether or not my instance of datatables is in the process of "loading" data from an ajax request; I have a jquery event for hovering over an element within my datatable cells; and if this is triggered during a reload of data via ajax (for example on a column sort, or page change) - it basically screws up.

I want to detect if datatables is busy reloading/sorting data before I proceed with my "on hover" event.

Replies

  • datatradersdatatraders Posts: 7Questions: 0Answers: 0
    edited April 2014
    if you write a own function for the "ajax" option, you can use the success parameter in jQuery.ajax() to trigger a method activating your hovering events.

    like this:

    [code]
    function (data, callback, settings) {
    $.ajax({
    "url": "..."
    "data": data,
    "success": function (json) {
    YourTrigger();
    callback( json );
    },
    "error": function (xhr, error, thrown) {
    YourTrigger();
    return false;
    }
    });
    }
    [/code]
  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin
    There isn't a built in method for this, but its a good idea. I'll take a look into this.

    Allan
This discussion has been closed.