KoolReport's Forum

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

Customized Layout with header #313

Open V Vijaykumarr opened this topic on on Jun 11, 2018 - 9 comments

V Vijaykumarr commented on Jun 11, 2018

Hello,

Can you help me to achieve this structure.

My Code:

PHP:

->pipe(new ColumnMeta(array(
      "prod_tot"=>array(
        'type' => 'number',
        "prefix" => "$",
      ),
    )))
    ->pipe(new Pivot(array(
      "dimensions"=>array(
        "column"=>"created_year, created_month",
        "row"=>"team_name, user_name, join_date"
      ),
      "aggregates"=>array(
        "sum"=>"prod_tot",
        "count"=>"prod_tot"
      )
    )))

View:

PivotTable::create(array(
            "dataStore"=>$dataStore,
            "rowDimension"=>"row",
            "columnDimension"=>"column",
            "measures"=>array(
              "prod_tot - sum",
              'prod_tot - count',
            ),
            'rowSort' => array(
              'prod_tot - count' => 'desc',
            ),
            'columnSort' => array(
              'created_month' => function($a, $b) {
                return (int)$a < (int)$b;
              },
            ),
            'rowCollapseLevels' => array(0),
            'columnCollapseLevels' => array(0),
            'width' => '100%',
            'nameMap' => array(
              'prod_tot - sum' => 'Sales (in SGD)',
              'prod_tot - count' => 'Number of Transaction',
            ),
          ));

Thanks Much.

David Winterburn commented on Jun 11, 2018

Hi,

Please use the following code to customize the headers:

            'headerMap' => array(
              'prod_tot - sum' => 'Sales (in SGD)',
              'prod_tot - count' => 'Number of Transaction',
            ),

And did you want to hide the total line for your report?

V Vijaykumarr commented on Jun 11, 2018

Yes i want to hide the total line.

V Vijaykumarr commented on Jun 11, 2018
'headerMap' => array(
              'prod_tot - sum' => 'Sales (in SGD)',
              'prod_tot - count' => 'Number of Transaction',
               'join_date' => 'Join Date'
            ),

Still didnt work. And cannot see the other header like sales, number of transaction also.

David Winterburn commented on Jun 11, 2018

Hi,

Can you tell us which version of KoolReport you are using? Thanks!

V Vijaykumarr commented on Jun 11, 2018

Current version, I just downloaded 3 days back.

David Winterburn commented on Jun 11, 2018

Please download our package including Examples and open the file examples/reports/pivot/years_months/YearsMonths.view.php.

Then replace "nameMap" property with "headerMap".

Finally open the page http://localhost/koolreport/examples/reports/pivot/years_months/index.php (your host path might be different) and let us know if the header is replaced correctly. Thanks!

V Vijaykumarr commented on Jun 11, 2018

OK will check, And how to remove the Total from unwanted places.?

David Winterburn commented on Jun 11, 2018

To hide the subtotal row, please add the following CSS rules to your page:

.pivot-row-header-total, .pivot-data-cell-row-total {
    display: none;
}

Thanks!

V Vijaykumarr commented on Jun 11, 2018

Then replace "nameMap" property with "headerMap".

This Solution fixed the header issue, Thanks.

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

Pivot