HTML E-mail and Datatables functions

HTML E-mail and Datatables functions

Lonnie.HullLonnie.Hull Posts: 32Questions: 11Answers: 0
edited June 2019 in Free community support

I'm using Knowledgesync to create webviews and send HTML based e-mails. I've used the code below to create a webview that adds totals to each break in the table.

$(document).ready(function() {
    $('#example').DataTable( {
        order: [[0, 'asc']],
        rowGroup: {
            startRender: null,
            endRender: function ( rows, group ) {
                var salaryAvg = rows
                    .data()
                    .pluck(5)
                    .reduce( function (a, b) {
                        return a + b.replace(/[^\d]/g, '')*1;
                    }, 0);
                salaryAvg = $.fn.dataTable.render.number(',', '.', 0, '$').display( salaryAvg );
 
                var ageAvg = rows
                    .data()
                    .pluck(3)
                    .reduce( function (a, b) {
                        return a + b*1;
                    }, 0) / rows.count();
 
                return $('<tr/>')
                    .append( '<td colspan="3">Total for '+group+'</td>' )
                    .append( '<td/>' )
                    .append( '<td/>' )
                    .append( '<td>'+salaryAvg+'</td>' );
            },
            dataSrc: 0
        }
    } );
} );
</script>

Does anyone know if it would be possible to output the same information into an HTML based email?

Thanks for any help.

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.