Change the column name of the PivotGrid

Posted by: ykumar23 on 5 December 2018, 9:20 pm EST

    • Post Options:
    • Link

    Posted 5 December 2018, 9:20 pm EST

    Hi,

    When I load pivot grid from the following link and set only “Product” and “Country” in rows and select “Sales” as Values then the data is displayed as per the configuration in the grid. I can see “Product” “Country” and “Grand Total” in the grid. I wanted to change the “Grand Total” to “Sales”. How can I achieve this.

    https://demos.wijmo.com/5/angular/OLAPIntro/OLAPIntro/

    Thanks in advance.

  • Posted 6 December 2018, 9:20 pm EST

    Hi,

    For this, you need to handle ItemFormatter for PivotGrid and check if the columns length is 1 and set the column header accordingly.

    Please refer to the following code snippet:

    $scope.itemFormatter=function(panel,r,c,cell){
                    console.log("df")
                    if(panel.cellType==wijmo.grid.CellType.ColumnHeader && panel.columns.length==1){
                        var span= cell.querySelector("span");
                        span = span ? span.outerHTML:"";
                        cell.innerHTML=panel.grid.engine.valueFields[0].header+ span;
                    }
                }
    

    ~ManishPivotGrid.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels