Send data when using .draw() ?

Send data when using .draw() ?

CharlyPoppinsCharlyPoppins Posts: 16Questions: 2Answers: 0

Hi,

I'm manually setting some data with ajax:data it works if trigger .draw() using column filtering :

dtTableAPI.columns("e.etat:name").search(val_etat);
dtTableAPI.draw();

but it don't work when I try do .draw or ajax.reload in the initComplete.

With console.log I saw :

  • ajax.data.function is called but dateDebut and dateFin are null

  • initComplete is called but neither .draw or .ajax.reload() is triggering ajax.data.function

do I miss somehing ?

table.dataTable({
    ajax: {
        url: myurl
            data: function (d) {
                d.dateDebut = dateDebut;
                d.dateFin = dateFin;
            }
    }
...
    initComplete: function (settings, json) {
        dtTableAPI = $("#table").DataTable();
        dateDebut = "01/01/2016";
        dateFin = "31/01/2016";
        dtTableAPI.draw();
        dtTableAPI.ajax.reload();
    }
...

I hope my explanations are clear enough.

ps : The code is working (don't mind if there is typo or whatever, I summarized it).

Answers

  • CharlyPoppinsCharlyPoppins Posts: 16Questions: 2Answers: 0

    up ?

  • allanallan Posts: 63,823Questions: 1Answers: 10,517 Site admin

    Thanks for your question - however, per the forum rules can you link to a test case showing the issue please. This will allow the issue to be debugged.

    Information on how to create a test page, if you can't provide a link to your own page can be found here.

    Thanks,
    Allan

This discussion has been closed.