preloader feature

preloader feature

kikokiko Posts: 10Questions: 0Answers: 0
edited July 2009 in General
hi Allan, is there a preloader that I can use before rendering all the data?

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    edited July 2009
    Hi kiko,

    Actually I think there is a bug in the code here. During the initialisation, if bProcessing is set to true, then I think that the processing display element should show up. However, this is not currently the case. I've put a fix in my code for this now, and I'll release it in the next revision. For the mean time you can add the fix in yourself if you like (it's s small alteration). In the function _fnFeatureHtmlProcessing() find the line:

    [code]
    nProcessing.style.visibility = "hidden";
    [/code]
    and replace with:

    [code]
    nProcessing.className = "dataTables_processing";
    if ( !oSettings.oFeatures.bProcessing )
    {
    nProcessing.style.visibility = "hidden";
    }
    [/code]
    Then all you need to do is set bProcessing to true in the initialisation object and you'll get the processing element flashing up. It is worth nothing that this bug is present only for DOM and JS array sources. AjaxSource and Server-side processing do not suffer from this issue.

    If you want to then disable the processing after load you can do something like:

    [code]
    var oTable = $('#whatever').dataTable({ bProcessing: true });
    oTable.fnSettings().oFeatures.bProcessing = false;
    [/code]

    Then you've got a real pre-loader :-)
    (a further note - generally changing features after initialisation is not recommended - but it should work fine in this case).

    Regards,
    Allan
  • kikokiko Posts: 10Questions: 0Answers: 0
    Hi Allan, I think this still not works I tested it in Firefox anf IE6. Below is the code:
    [code]
    oTable = $('#example').dataTable({
    "bProcessing": true,
    "oLanguage": {
    "sSearch": "Search all columns:"
    }
    });
    [/code]
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    HI kiko,

    Oops - small error in my code. I've just corrected my original comment. It should have been !oSettings.oFeatures.bProcessing...

    How long is your initialisation taking? Remember that this should occur very quickly, unless you are using a very large data set.

    Allan
  • kikokiko Posts: 10Questions: 0Answers: 0
    Still not works! I can't see it, i have 4764 entries...is there an image preloader?
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    What should happen is that the processing element will flash up with the word "Processing..." and whatever styling you want. If you want to add images, then you need to add that in via the language variables with HTML or use CSS to display the image.

    Also one more change in the code. You might as well delete the 'nProcessing.style.visibility = "hidden";' line I've pointed out above. It makes no difference.

    Allan
  • bahalloubahallou Posts: 5Questions: 0Answers: 0
    Hi kiko,
    I would like to know if you found a solution for your 4700 entries using DataTables.
    I'm in the same case :-(
    thanks
This discussion has been closed.