Customizing the "Processing.." message

Customizing the "Processing.." message

fitsum80fitsum80 Posts: 17Questions: 0Answers: 0
edited August 2011 in General
I am trying to customize the datatable's "Processing.." message ("bProcessing": true) while the large data is rendering. Is there any way I can call another javascript function instead of "Processing..." message when the user click on the pagination or sorting ? Also is it possible to show the datatables's "Processing.." message only for the filtering feature?

Thank you in advance!
Fitsum

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    the language settings let you change that.
    http://datatables.net/ref

    [code]
    $(document).ready(function() {
    $('#example').dataTable( {
    "oLanguage": {
    "sProcessing": "DataTables is currently busy"
    }
    } );
    } );
    [/code]
  • fitsum80fitsum80 Posts: 17Questions: 0Answers: 0
    Thanks fbas for a quick response. But I would like to do something like this if possible.
    $(document).ready(function() {
    $('#example').dataTable( {
    "oLanguage": {
    "sProcessing": showMessage()
    }
    } );
    } );
    I have a custom javascript function (i.e. showMessage()) that show different message with overlay.
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    you can use the various callback functions to trigger your showMessage() function
  • fitsum80fitsum80 Posts: 17Questions: 0Answers: 0
    Do you have any example by chance fbas?
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    What is the timing you want the message to show and go away?

    Probably your best bet are the fnPreDrawCallback and fnDrawCallback, since they happen before and after a table draw/refresh

    [code]
    $(document).ready(function() {
    $('#example').dataTable( {
    "fnPreDrawCallback": function() {
    // gather info to compose a message
    showMessage(...);
    },
    "fnDrawCallback": function() {
    // in case your overlay needs to be put away automatically you can put it here
    hideOverlay();
    }
    } );
    } );
    [/code]
  • fitsum80fitsum80 Posts: 17Questions: 0Answers: 0
    I would like to show the "loading message" with overlay until the datatables completely loaded the data and hide it once done. I have tried the above codes but it didn't work. Did I miss anything?
    $(document).ready(function() {
    $('#example').dataTable( {
    "fnPreDrawCallback": function() {
    showMessage();
    },
    "fnDrawCallback": function() {
    hideMessage();
    }
    } );
    } );
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    apologies: fnPreDrawCallback must return true if you want the draw to continue

    [code]

    $(document).ready(function() {
    $('#example').dataTable( {
    "fnPreDrawCallback": function() {
    // gather info to compose a message
    showMessage();
    return true;
    },
    "fnDrawCallback": function() {
    // in case your overlay needs to be put away automatically you can put it here
    hideOverlay();
    }
    } );
    } );

    [/code]
  • fitsum80fitsum80 Posts: 17Questions: 0Answers: 0
    no worries. but still doesn't work. I couldn't find any function called "fnPreDrawCallback" in jquery.datatables.js file though.
  • fitsum80fitsum80 Posts: 17Questions: 0Answers: 0
    ok sorry. I see it in version 1.8.1. Let me upgrade to 1.8.1 and try it.

    Thanks,
    Fitsum
  • fitsum80fitsum80 Posts: 17Questions: 0Answers: 0
    Thank you very much fbas! It is working now exactly how I wanted it.

    Fitsum
This discussion has been closed.