Serverside DataTable not calling Ajax on first load

Serverside DataTable not calling Ajax on first load

TonnyCTonnyC Posts: 6Questions: 1Answers: 0

I have a Jquery DataTable not calling Ajax on first load. What am I missing?

When doing paging and search table gets populated correctly. But first load is empty. I know for a fact that the first call is not being made to the backend - I also get no error but I do get 'No matching records found'.

Here is what I know:

My code works if serverSide is false!
My backend works if ServerSide is false,

My code works if serverSide is true!
My backend works if ServerSide is true!

Any suggestions are welcome:-) I am strugling.

Answers

  • TonnyCTonnyC Posts: 6Questions: 1Answers: 0

    Please help

    I have made a fiddle showing the table:

    https://jsfiddle.net/L9o82apw/4/

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Hi @TonnyC ,

    That fiddle isn't getting the data due a CORB error, so it's hard to diagnose. At a glance, everything looks like it should - is it possible to link to your page where the problem can be demonstrated?

    Cheers,

    Colin

  • TonnyCTonnyC Posts: 6Questions: 1Answers: 0

    Hi Colin,

    Sure I will set it up.

    I will be back.

    Thanks a lot for looking at it:-)

    Tonny

  • TonnyCTonnyC Posts: 6Questions: 1Answers: 0

    Hi Colin,

    Here is a link to the culprit, https://prozapia.com/themeviewer/testpaging.html

    As you can see there is no call on first load. But once you start paging the AJAX is fired and the table is populated.

    Any suggestions are welcome:-)

    Best regards

    TonnyC

  • TonnyCTonnyC Posts: 6Questions: 1Answers: 0

    Got tired of waiting and found what I think is a hack.

    This is the second call after the datatable has been intilalised.

    $('#ressourceTable').DataTable().ajax.reload();

    I am sure this is not right way of doing it but it works. As stated above I think this is a Hack

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    I was going to take a look tomorrow, on a bank holiday, but glad you found a solution...

  • TonnyCTonnyC Posts: 6Questions: 1Answers: 0

    Hi Colin,

    Thanks.-) I don't think it is the right solution though:-( It looks more like a hack

    Can you tell me the right way of doing it?

    Thanks

    TonnyC

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    I just tried your link again, and it's giving a 404. Could you relink to the page, please. There's no reason why it should need a ajax.reload() immediately, so would be interesting to see.

This discussion has been closed.