KoolReport's Forum

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

Pivot matrix using both map & headerMap #1107

Open Ralf Föhring opened this topic on on Sep 30, 2019 - 1 comments

Ralf Föhring commented on Sep 30, 2019

It looks likethe headerMap definition is getting overwritten by the map definition even if in the map I've only defined the dataCell

David Winterburn commented on Oct 1, 2019

Hi Ralf,

We will make headerMap and map compatible with each other in the next release of Pivot. For the time being, you could fix this issue by opening the file Pivot/PivotUtil.php and replace these lines:

        list($mappedFields, $rowFieldsClass, $rowFieldsExcelStyle) = 
            $this->getMappedFieldsAttributes('row', $rowFields);
        if (! empty($this->map)) $mappedRowFields = $mappedFields;
        list($mappedFields, $colFieldsClass, $colFieldsExcelStyle) = 
            $this->getMappedFieldsAttributes('column', $colFields);
        if (! empty($this->map)) $mappedColFields = $mappedFields;
        list($mappedFields, $dataFieldsClass, $dataFieldsExcelStyle) = 
            $this->getMappedFieldsAttributes('data', $dataFields);
        if (! empty($this->map)) $mappedDataFields = $mappedFields;
        list($mappedFields, $dataHeadersClass, $dataHeadersExcelStyle) = 
            $this->getMappedFieldsAttributes('dataHeader', $dataFields);
        if (! empty($this->map)) $mappedDataHeaders = $mappedFields;
        list($mappedFields, $waitingFieldsClass, $waitingFieldsExcelStyle) = 
            $this->getMappedFieldsAttributes('waiting', $waitingFields);
        if (! empty($this->map)) $mappedWaitingFields = $mappedFields;

        list($mappedNodes, $rowNodesClass, $rowNodesExcelStyle) = 
            $this->getNodesAttributes('row', $rowNodes, $rowNodesInfo);
        if (! empty($this->map)) $mappedRowNodes = $mappedNodes;
        list($mappedNodes, $rowNodesClassBun, $rowNodesExcelStyleBun) = 
            $this->getNodesAttributes('row', $rowNodes, $rowNodesInfoBun);
        if (! empty($this->map)) $mappedRowNodesBun = $mappedNodes;
        list($mappedNodes, $colNodesClass, $colNodesExcelStyle) = 
            $this->getNodesAttributes('column', $colNodes, $colNodesInfo);
        if (! empty($this->map)) $mappedColNodes = $mappedNodes;

with these:

        list($mappedFields, $rowFieldsClass, $rowFieldsExcelStyle) = 
            $this->getMappedFieldsAttributes('row', $rowFields);
        if (isset($this->map['rowField'])) $mappedRowFields = $mappedFields;
        list($mappedFields, $colFieldsClass, $colFieldsExcelStyle) = 
            $this->getMappedFieldsAttributes('column', $colFields);
        if (isset($this->map['columnField'])) $mappedColFields = $mappedFields;
        list($mappedFields, $dataFieldsClass, $dataFieldsExcelStyle) = 
            $this->getMappedFieldsAttributes('data', $dataFields);
        if (isset($this->map['dataField'])) $mappedDataFields = $mappedFields;
        list($mappedFields, $waitingFieldsClass, $waitingFieldsExcelStyle) = 
            $this->getMappedFieldsAttributes('waiting', $waitingFields);
        if (isset($this->map['waitingField'])) $mappedWaitingFields = $mappedFields;
        list($mappedFields, $dataHeadersClass, $dataHeadersExcelStyle) = 
            $this->getMappedFieldsAttributes('dataHeader', $dataFields);
        if (isset($this->map['dataHeader'])) $mappedDataHeaders = $mappedFields;

        list($mappedNodes, $rowNodesClass, $rowNodesExcelStyle) = 
            $this->getNodesAttributes('row', $rowNodes, $rowNodesInfo);
        if (isset($this->map['rowHeader'])) $mappedRowNodes = $mappedNodes;
        list($mappedNodes, $rowNodesClassBun, $rowNodesExcelStyleBun) = 
            $this->getNodesAttributes('row', $rowNodes, $rowNodesInfoBun);
        if (isset($this->map['rowHeader'])) $mappedRowNodesBun = $mappedNodes;
        list($mappedNodes, $colNodesClass, $colNodesExcelStyle) = 
            $this->getNodesAttributes('column', $colNodes, $colNodesInfo);
        if (isset($this->map['columnHeader'])) $mappedColNodes = $mappedNodes;

Let me know if this works for you. 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

Pivot