This is a migrated thread and some comments may be shown as answers.

Change Grand Total Header Text

5 Answers 60 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Julian
Top achievements
Rank 1
Julian asked on 21 Apr 2015, 07:11 PM

This would seem easy but I've not been able to figure out how to change the GrandTotalHeaderColumn text.

 I am able to change column text for regular columns like this:

 

 

if (IsModelDataCellPlannedHeader(modelDataCell))
                       {
                           e.ExportedCell.Value = "Plan";
                       }
 
private static bool IsModelDataCellPlannedHeader(PivotGridBaseModelCell modelDataCell)
       {
           return modelDataCell.TableCellType == PivotGridTableCellType.ColumnHeaderCell &&
                  modelDataCell.Field.UniqueName == "Plan";
 
       }

 

 This works fine but I cannot figure out how to tell if a column is a GrandTotalColumn.

This code does not work:

 

private static bool IsModelDataCellPlanGrandTotalHeaderColumn(PivotGridBaseModelCell modelDataCell)
        {
            if (modelDataCell.TableCellType == PivotGridTableCellType.ColumnHeaderCell &&
             modelDataCell.CellType == PivotGridDataCellType.ColumnGrandTotalDataCell &&
                   modelDataCell.Field.UniqueName == "plannedValue")
            {
                return true;
 
            }
 
            if (modelDataCell.TableCellType == PivotGridTableCellType.ColumnHeaderCell &&
             modelDataCell.CellType == PivotGridDataCellType.RowGrandTotalColumnTotal &&
                   modelDataCell.Field.UniqueName == "plannedValue")
            {
                return true;
            }
            return false;
 
        }

Obviously I was just shooting in the dark. It would be nice if there was a TableCellType of GrandTotalColumnHeader. That would seem to make sense.

 Let me know if there is a way to do what I'm trying to do.

Thanks!

5 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 24 Apr 2015, 01:24 PM
Hello Julian,

Unfortunately the RadPivotGrid control does not provide the ability to get the "GrandTotalColumnHeader" independently as a cell in order to format it on the server. However this request is already logged in our system and our dev team will implement is as soon as possible.

Excuse us for any inconvenience this limitation may currently lead.

Regards,
Maria Ilieva
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Julian
Top achievements
Rank 1
answered on 24 Apr 2015, 02:07 PM

Maria,

 Thank you for the reply. I will waste no more time trying to get at the text of the "GrandTotalColumnHeader".

 Happy Friday :)

 

0
Hiram
Top achievements
Rank 1
answered on 15 May 2015, 03:00 PM

Hi, i changed the grand total column text, this works for me

protected void rpgGroupedData_PivotGridCellExporting(object sender, PivotGridCellExportingArgs e)
 {
            if (e.ExportedCell.Value != null)
            {
                    if (e.PivotGridModelCell.CellType == PivotGridDataCellType.DataCell)
                    {
                              if (e.PivotGridModelCell.IsGrandTotalCell && e.ExportedCell.Value.ToString().Equals("Total Sum of Subtotal"))
                            e.ExportedCell.Value = "Grand Total";
                     }
            }
}
{
                    if (e.PivotGridModelCell.IsGrandTotalCell && e.ExportedCell.Value.ToString().Equals("Total Sum of Subtotal"))
                        e.ExportedCell.Value = "Grand Total";

}

0
Hiram
Top achievements
Rank 1
answered on 15 May 2015, 03:02 PM
the last IF (outside the block) was an paste-error, look only the code inside the block
0
Maria Ilieva
Telerik team
answered on 19 May 2015, 07:11 AM
Hi,

The approach that Hiram has provided works properly for changing the GrandTotalColumn text in the data cell for the exported file.
Our development team is currently working on exposing GrandTotalColumnHeader cell type sop that the required functionality can be easily achieved.

Regards,
Maria Ilieva
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
PivotGrid
Asked by
Julian
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Julian
Top achievements
Rank 1
Hiram
Top achievements
Rank 1
Share this question
or