Loading data from an object while processing

Loading data from an object while processing

islamelshobokshyislamelshobokshy Posts: 99Questions: 20Answers: 1
edited May 2018 in Free community support

I want datatables to show 'loading..' when it is loading an object into it's rows like so

processing: true,
data: jsonB.data,

but that doesn't work, I don't call any ajax in Datatables (I call it outside and use the resulted object inside datatables), is that why I don't have any loading text ? How can I have it anyway with 'data' and not 'ajax' ?

This question has accepted answers - jump to:

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598
    Answer ✓

    Hi again,

    With processing set, you should see the processing message on ordering. You won't see it on the load, as the browser will be grouping the redraws. If you add the option deferRender it'll significantly speed up the load, so you probably wouldn't see the processing message there either. And likewise the search, it's probably so fast you won't see it there either.

    This example here might be worth playing with, as it's a large dataset and takes a while to do things.

    Cheers,

    Colin

  • islamelshobokshyislamelshobokshy Posts: 99Questions: 20Answers: 1
    edited May 2018

    So I can't have the processing show up when I use data and not ajax? Is there a way to do it anyway? As no the problem is not that the page loads too fast (my datatables loads 400k+ results and I don't have pagination (no, I'm not crazy, I didn't just have a choice :P))

    So in your link, is there a way to have a loading text/icon anyway? It might not appear in your url but it'll show me how to do it. As simply adding processing true doesn't work...

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    As I said, not with the load. But, as I said, have you tried loading with deferRender, that might make the performance that much quicker that it's not required

  • islamelshobokshyislamelshobokshy Posts: 99Questions: 20Answers: 1

    I tried, and it's still taking me 3-5 seconds to load. And in any case I've been asked to do it anyway by my project manager. So do I have to pass by JS to do so?

  • colincolin Posts: 15,237Questions: 1Answers: 2,598
    Answer ✓

    You can create your own loading message fairly simply. For example, before you initialise the table, you can display a message, and then in the initComplete function you can remove/hide it. That would give you what you're after.

    C

  • islamelshobokshyislamelshobokshy Posts: 99Questions: 20Answers: 1

    Yeah I'll do something like that, thanks colin !

This discussion has been closed.