KoolReport's Forum

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

Pivotmatrix columns cleared on empty data #1097

Open Ralf Föhring opened this topic on on Sep 23, 2019 - 3 comments

Ralf Föhring commented on Sep 23, 2019

Hi, I have tweaked the pivotMatrix.update() function to include the parameters from the Input Package into pivot reload XHR request because it seems there is no support for that and I've noticed the folowing scenario: if the data source for the piovtMatrix returns empty then the pivot renders without the column and row headers. If you drag the column/row fields around they end up cleared away. In this scenario the fields should normally be put back into the waiting list if the pivot query returns no data.

David Winterburn commented on Sep 23, 2019

Hi Ralf,

There's another way to include a form inputs' values into the PivotMatrix to . Please try the scope property of PivotMatrix like this:

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

On the other hand, if you want to keep a PivotMatrix's state persistent across submitting, please add the following hidden input to your form:

<form>
    <input type='hidden' name='koolPivotUpdate' value=1 />
    <?php
        PivotMatrix::create(array(
        ...
        ));
</form>

Let me know if you need anything else. Thanks!

Ralf Föhring commented on Sep 24, 2019

Not a helpful solution. $this->params and $_POST is only available on submit, but If I group the header/row fields then the pivot update does not include the current inputs/filter parameters and get different data back so I cannot have a continuous dinamic analityc process. <input type='hidden' name='koolPivotUpdate' value=1 /> does not help.

I'll try to explain it more concrete in pictures.

1 This is right after first page load

2 Customer field being dragged in row groups. I know it makes no sense to group no data but it's just an example

3 The result:

David Winterburn commented on Sep 27, 2019

Hi Ralf,

You are correct. At the moment if data were empty a PivotMatrix's field zones would be empty, too. We will fix this behaviour to make PivotMatix's state more consistent even in the case of empty data in the next release of the Pivot package. Please send us an email to support@koolphp.net if you want an updated version of Pivot. 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
suggestion

Pivot