KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.

Create rowGroup in DataTables of DataGrid package #367

Open KoolReport opened this topic on on Jul 12, 2018 - 3 comments

KoolReport commented on Jul 12, 2018


I have been looking around your forum for an example to the problem I have but I can't find one.

I am working with DataTables and need to add custom rows to the table. The link below shows what I am looking for.


Do you have an example that you can send me?


Here is sample code of creating the same effect like above example:

        "order"=> [[2, 'asc']],
            "endRender"=>"function ( rows, group ) {
                var salaryAvg = rows
                    .reduce( function (a, b) {
                        return a + b.replace(/[^\d]/g, '')*1;
                    }, 0) / rows.count();
                salaryAvg = $.fn.dataTable.render.number(',', '.', 0, '$').display( salaryAvg );
                var ageAvg = rows
                    .reduce( function (a, b) {
                        return a + b*1;
                    }, 0) / rows.count();
                return $('<tr></tr>')
                    .append( '<td colspan=\"3\">Averages for '+group+'</td>' )
                    .append( '<td>'+ageAvg.toFixed(0)+'</td>' )
                    .append( '<td></td>' )
                    .append( '<td>'+salaryAvg+'</td>' );

Note: This example works with KoolReport 2.75.0 and DataGrid 1.5.0

Jesus commented on Jul 12, 2018

Thank you for your quick response.

I am using your data table example with your input_and_export example but can't get it to work. Can you show me how you would use it in your input_and_export? When I add endRender the datatable looks just like a regular table. No sorting, paging or searching.

Thanks Jesus

KoolReport commented on Jul 15, 2018

Hi Jesus,

Just to let you know that we have released version 2.78.0 of KoolReport Pro. Please download this version and follow my above code.

Jesus commented on Jul 17, 2018

Thank you it works

Give tips to supporter for his good work

If you feel that supporter has done a good work, consider giving him some credit. Any amount put into the tips box below is appreciated. By doing so, you have contribtuted to the existence of KoolReport and the quality of support.

Tips box