KoolReport's Forum

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

How to perform sort in PivotMatrix #2729

Open DVBI opened this topic on on Jun 16 - 4 comments

DVBI commented on Jun 16

Hello Team, I am trying to create a pivot table... I have 2 questions

  1. How can i perform sort options... while clicking on sort it is throwing Method Not Allowed Exception added screenshot here
  2. I need to change the column header name... can you suggest how can i implement that?

my implementation of pivot matrix code

PivotMatrix::create(array(
        "id" => "pivotMatrix1",
        'dataSource' => function () {

            return $this->src('mysql')
                ->query($this->query)
                ->pipe(new PivotSQL(array(
                    "dimensions" => array(
                        "column" => implode(',', $this->column_fields),
                        "row" => implode(',', $this->row_fields),
                    ),
                    "aggregates" => array(
                        "sum" => implode(',', $this->aggregate_fields),
                    )
                )));
        },
        "columns" => $this->column,
        "serverPaging" => true,
        'width' => '100%',
        
        // 'rowCollapseLevels' => array(0),
        // 'width' => '100%',
        // 'height' => '500px',
        // 'template' => 'PivotMatrix-Bun',
        // 'totalName' => 'Total',
        'hideGrandTotalRow' => true,
        'hideGrandTotalColumn'=> true,
        'method' => 'GET',

        'paging' => array(
            'size' => 10,
            'maxDisplayedPages' => 5,
            'sizeSelect' => array(5, 10, 20, 50, 100)
        )
    ));

Error

Image

Sebastian Morales commented on Jun 17

Hi, PivotMatrix uses POST ajax request to perform its operation such as sorting. Pls add post method beside get request for the route to your PivotMatrix page. Rgds,

DVBI commented on Jun 17

Hi Sebastian, Thanks for your response... It works... but how can i change the column name in the pivot table?

Sebastian Morales commented on Jun 20

You can use PivotMatrix's map's columnField, rowField to change the column, row, and data field names:

https://www.koolreport.com/docs/pivot/pivottable_and_pivotmatrix/#properties-map-(version-%3E=-5.0.0)

DVBI commented on Jun 20

Thanks Sebastian it works!

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
solved

Pivot