KoolReport's Forum

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

How to fix PivotTable and/or PivotMatrix header #2784

Open paulo opened this topic on 5 days ago - 4 comments

paulo commented 5 days ago

Hi Team, two questions about PivotTable and PivotMatrix.

  1. How can I fix the header so when scrolling down the column titles are also visitable. Similar to Datatable
  2. Is there a default export to Excel function even if it exports flat/SQL result to excel ? thank you
Sebastian Morales commented 5 days ago

1 . Pls try to set these CSS rules:

    position: sticky;
    top: 0;

for the PivotTable/PivotMatrix headers. These probably won't work if you use css flex in your parent elements. In such case more CSS rules are needed.

2 . Pls give a specific example so that we understand your requirement to find a solution. Tks,

paulo commented 4 days ago

Thank you, here is what I have:

?> <html> <head>

<title>Tour Stats by Fiscal Year</title>
<link rel="stylesheet" type="text/css"
      href="https://cdn.datatables.net/fixedheader/3.1.2/css/fixedHeader.dataTables.min.css">

</head> <body> <div class="report-content">

<div>
    <?php
    PivotMatrix::create(array(
        //'template' => 'PivotTable-Bun',
        //'showDataHeaders' => true,
        "dataStore"=>$this->dataStore('queryTourByFiscalYearSalesPOTENTIAL')
    ));

    ?>
</div>

</div> </body> </html>

So where do you want me top place the CSS rule? You don't see the settings here because they are done at the class level ->pipe(new ColumnMeta(array(

            "TotalGrossCommMinusPaid"=>array(
                'type' => 'number',
                "prefix" => "$",
            ),
        )))
paulo commented 4 days ago

for question number two , the results that are displayed under the below PivotMatrix, is there a way of exporting them to Excel ? (even if is comes as a list instead of Pivot). This way if an employee questions why things are like this they can see the ID of the record, go there and exam themselves rather relying on IT to run queries and provide further info.
thanks

PivotMatrix::create(array(

    //'template' => 'PivotTable-Bun',
    //'showDataHeaders' => true,
    "dataStore"=>$this->dataStore('queryTourByFiscalYearSalesPOTENTIAL')
));
Sebastian Morales commented 21 hours ago

1 . You have to inspect elements that you want to be sticky and add CSS rules to your page. For example:

//MyReport.view.php
<style>
    .pivot-column {
        position: sticky !important;
        top: 0;
    }        
</style>

Still, a fixed header is not simple and it depends on your page's lay out and other CSS files/rules as well.

2 . Did you try our excel PivotTable/PivotMatrix widget to export pivot result to excel:

https://www.koolreport.com/docs/excel/export_to_excel/#excel-export-template-(version-%3E=-6.0.0)

https://www.koolreport.com/docs/excel/excel_widgets/#pivottable-widget-(version-%3E=-6.0.0)

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
help needed

Pivot