Export footer in excel: in pagination partial, prepend SUBTOTAL string in footer

Export footer in excel: in pagination partial, prepend SUBTOTAL string in footer

itajackassitajackass Posts: 155Questions: 47Answers: 3
edited December 2019 in Free community support

I have a table with a column (with class currency) of currencies to sum with:

        "footerCallback": function(row, data, start, end, display) {
      var api = this.api();

      api.columns('.currency', {
        page: 'current'
      }).every(function() {
                    var sum = 0;
        var td = this.nodes();
                    $(td).each(function(index, value) {

                       var valore = parseFloat($(this).html()) || 0;

                       sum = sum + valore;

                    });
        $(this.footer()).html(sum.toFixed(2));
      });

    },...

Now All is ok if pagination view is set to ALL. but if pagination split table in pages, during export I like to prepend a string "SUBTOTAL: " to my sum result (in the footer) to indicate to the user he has exported only a partial table...how can I do this?

Answers

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

    It would probably be easier to always display it in the footer, that way the export wouldn't have to do anything special. Otherwise, it would be specific to the export format, as each would have different ways to iterate through.

    Colin

This discussion has been closed.