Tell datatables to show processing indicator. Also perhaps use GIF.

Tell datatables to show processing indicator. Also perhaps use GIF.

PaulRedPaulRed Posts: 6Questions: 0Answers: 0
edited May 2013 in General
Hi
I am using DataTables with large datasets but using my own code to retrieve and sort the data before rendering in a page of DataTables. The main reason for this is that the data retrieval has to use multiple SOAP calls. So once I have the data I present to DataTables. For the same reason I am using my own pager. This is all working fine but I would like to display a paging indicator while the data is being retrieved/sorted.

So the code when refreshing after a paging change looks like this:
[code]
oTable.fnClearTable();
ShowBusy();
GetDataset(sSortField, oSortColumn, bSortDescending, pageNo, pageSize);
oTable.fnAddData(aDataSet);
StopBusy();
[/code]
I've been trying to use some external code with an animated gif which I show then hide. However I note that the scroller has a built in processing indicator which could work here if I could make ti get shown. Is there a way that I can tell DataTables to show it even though DataTables does not think it is busy?

Also is there a way to use an animated gif instead. This is an add-on for a Microsoft CRM which uses an animated gif so it would be good to use this same one. This is not essential.

Thanks and sorry I cannot post a working example - just too complex.

Paul

Replies

  • allanallan Posts: 61,627Questions: 1Answers: 10,090 Site admin
    Hi Paul,

    > Is there a way that I can tell DataTables to show it even though DataTables does not think it is busy?

    This plug-in might be of interest: http://datatables.net/plug-ins/api#fnProcessingIndicator . It will allow you to show and hide the DataTables processing indicator ( bProcessing ). To show it with an animated gif, you can use the language settings: http://datatables.net/usage/i18n#oLanguage.sProcessing . Simply set it to be an HTML string with an `img` tag to show the gif.

    Regards,
    Allan
  • PaulRedPaulRed Posts: 6Questions: 0Answers: 0
    Makes excellent sense - perfect... or should be. Trouble is it is not appearing. I have set bProcessing to true. Looking at the HTML after I call the function to set processing it looks like this:
    [code]Processing...[/code]

    which seems fine and the style sheet has

    [code].dataTables_processing {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 250px;
    height: 30px;
    margin-left: -125px;
    margin-top: -15px;
    padding: 14px 0 2px 0;
    border: 1px solid #ddd;
    text-align: center;
    color: #999;
    font-size: 14px;
    background-color: white;
    }
    [/code]
    It could be something about the Dynamics CRM web resource in which this is running but the HTML looks clear. I just wonder if it is the position parameter and the fact that it within a sort of iFrame.

    Any thoughts?
  • psharppsharp Posts: 39Questions: 0Answers: 0
    I've something of the same kind of situation. We've set up a "processing" div that is initially hidden, and is set to visible whenever there is server communication etc..

    Here is the relevant discussion link:
    http://datatables.net/forums/discussion/comment/47841#Comment_47841
  • PaulRedPaulRed Posts: 6Questions: 0Answers: 0
    Thanks for this - I think it might be the best approach. I will try that. Thanks again.
  • allanallan Posts: 61,627Questions: 1Answers: 10,090 Site admin
    @PaulRed - Are you able to give me a link to the page you are working on. I'm afraid I don't see why the processing element wouldn't be showing up with your above code.

    Having said that, the option of using the `processing` event in the thread linked to by psharp is a good one if you want to use your own processing indicator.

    Regards,
    Allan
This discussion has been closed.