initComplete callback on pagenation?

initComplete callback on pagenation?

jasper502jasper502 Posts: 25Questions: 9Answers: 0
edited March 2021 in Free community support

I have a callback like this:

    initComplete: (settings, json) ->
          $('#expenditures_info').append(json['info'])

where I append some server side text to the DataTable summary:

Showing 1 to 20 of 51 entries ($38,228.96 of $117,176.44 total)

Where I total a column on the results from page shown vs all pages. This works on the initial page load but reverts to the default on subsequent calls and draws etc:

Showing 21 to 40 of 51 entries

Can I do this or is there a different callback that applies?

Answers

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

    Yep, you'll need to also add to the draw - something like this,

    Colin

  • jasper502jasper502 Posts: 25Questions: 9Answers: 0

    Your reply inspired me to dig a big deeper. In my case it was as simple as:

      drawCallback: function(settings) {
        return $('#expenditures_info').append(settings.json.info);
    
This discussion has been closed.