KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

How to extend datatables buttons within koolreport? (i.e. set orientation and pagesize for pdfHtml5) ? #1930

Closed Jeremy Gray opened this topic on on Feb 27, 2021 - 2 comments

Jeremy Gray commented on Feb 27, 2021

koolreports plugin example uses nearly same syntax as Datables example for buttons: https://datatables.net/extensions/buttons/examples/initialisation/simple.html

But I am not able to figure out how to pass more like....

            "buttons" => [
                        'copy', 'csv', 'excel', 'pdf', 'print'
{
extend: 'pdfHtml5',
orientation: 'landscape',
pageSize: 'LEGAL' }
            ],

will not work.... I get error:

Parse error: syntax error, unexpected '{', expecting ']'

Jeremy Gray commented on Feb 27, 2021

I think I figured it out... you have to pass them in an array I guess? This works....

            "dom" => 'Bfrtip',
            "buttons" => [
                        'copy', 'csv', 'excel',

  array(
            'extend'=>'pdfHtml5',
            'orientation'=>'landscape',
            'pageSize'=>'LEGAL',
            'text'=>'PDF'
        ),

'print',
            ],

ankit raj commented on Mar 1, 2021

Yes. That seems to be the way. This is how I used for a font-awesome icon incase someone needs it.

 "buttons" => [
                    array(
                        'extend'=>'excelHtml5',
                        'text'=>'<i class="fa fa-file-excel-o"></i>',
                        'titleAttr'=>'Excel'
                    )
                ],

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
None yet

DataGrid