KoolReport's Forum

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

Datatable - create a new page for each grouping #2044

Open Lloyd opened this topic on on Apr 22, 2021 - 11 comments

Lloyd commented on Apr 22, 2021

Hi,

Is it possible to force the start of a new page for each DataTables's clientRowGroup when a change oocurs (ie: on a change of the custemerName)?

"clientRowGroup" => [

    "customerName" => [
            'direction' => 'asc',
            'calculate' => [
                    'totalSales' => [
                            'sum',  //'sum', 'count', 'avg', 'min', 'max' 
                            'dollar_sales'
                    ],
            ],

            "top" => "<td colspan='999'>{expandCollapseIcon} Top: Customer: {customerName} | Total: {totalSales}        
             </td>",

            "bottom" => "<td colspan='999'>{expandCollapseIcon} Bottom: Customer: {customerName} | Customer 
              sales: {totalSales}</td>",
        ],

]

Any help would be greatly appreciated.

Lloyd

Sebastian Morales commented on Apr 23, 2021

Did you mean a new page as in pdf export? Tks,

Lloyd commented on Apr 23, 2021

Yes, when I export the report to a PDF or HTML File.

Sebastian Morales commented on Apr 26, 2021

Pls try to add the following style to your top/bottom group row:

    style="page-break-before:always;"

or:

    style="page-break-after:always;"

Let us know if it works for you. Tks,

Lloyd commented on Apr 26, 2021

Hi,

I am very frustrated with your reply.

  • did you try this out before suggesting this style="page-break-before:always;

  • before replying to this comment, please test and if you can get it to work, please reply with some sample code on how to get this to work.

Up till now I have been very happy and impressed with your company's customer support, but your reply does not help me out in any way. I am sorry that I have respond like this, but as I mentioned I am very frustrated.

Hopefully you can reply with sample code so I may get this to work.

Thank you

Sebastian Morales commented on Apr 27, 2021

Pls try this in your pdf view:

    //MyReportPDF.view.php
    DataTables::create(array(
        ...
        "clientRowGroup" => [
                                "productName" => [
                                    "top" => "<td colspan='999'>Product: {productName}</td>",
                                    "bottom" => "<td colspan='999'><div style='page-break-before:always;'>&nbsp;</div>&nbsp;</td>",
                                ]
        ],
    ));

It works fine in our test. Rgds,

Lloyd commented on May 4, 2021

I finally got a chance to test the code you referenced in your last reply. Unfortunately, it does not work for me. As this plugin is based on the Datatables jquery plugin, is there another way to add this CSS code, to break to a new page on each clientRowGroup change?

Any help would be greatly appreciated.

Thank you.

Sebastian Morales commented on May 5, 2021

This custom PDF page break is intended to work when you export using our Export package. Did you export the table to PDF by using the Export package or DataTables' Buttons plugin? I'm not aware of any custom page break with the Buttons plugin. Rgds,

Lloyd commented on May 5, 2021

Yes, I tested it with the DataTables Buttons pdf export button using the Chrome Browser, and it did not work.

Can you tell me which browser you got it to work with?

I also tested it in 5 other browsers, and it did not work in any of them. Can you please verify the code in your comment of April 27, and make sure that the code is correct.

I really need to get this to work.

Lloyd

Sebastian Morales commented on May 6, 2021

Like I said, we don't have solution for custom page break for DataTables' Buttons plugin's PDF export. If you want custom page break one solution is using our Export package and the code I provided. Rgds,

Lloyd commented on May 6, 2021

Is there a way I can test the Export Package to ensure that it does exactly what I need, before purchasing the Export Package

Sebastian Morales commented on May 7, 2021

We have a 30 day full refund policy if customers don't find the software is what they need. So no worries about wasting your money if Export or any package doesn't work for you. Rgds,

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