KoolReport's Forum

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

How do I maintain a Filter after a Pivot with PivotMatrix? #1071

Open Giovanni opened this topic on on Sep 3, 2019 - 1 comments

Giovanni commented on Sep 3, 2019

Hi KR team!

My project involves a Pivot Matrix and some filters (, and I have trouble maintaining them if I make any change to the table. I update the table with the filters posting

<input type='hidden' name='koolPivotUpdate' value="1"/>

with my inputs but I didn't find any documentation on how can I pass the filters to the table if I pivot (moving a waiting field in a row/column for example) it.

Any suggestions?

Thanks in advance for any help you are able to provide.

David Winterburn commented on Sep 4, 2019

Hi Giovanni,

The hidden input named "koolPivotUpdate" is used to keep PivotMatrix's state when clicking a form submit button.

On the other hand, if you want to keep form filter values when operating the PivotMatrix itself (like expand/collapse), there's the scope property setting like this:

PivotMatrix::create(array(
    ...
    "scope" => array(
        "filter1" => $this->params["filter1"],
        "filter2" => $_POST["filter2"],
        ...
    ),
    ...       
));

This scope property makes sure the "filter1", "filter2", etc filter values are passed to PivotMatrix when it's run. Let us know if we understand your question correctly. 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
help needed

Pivot