Change Grand Total Header Text

6 posts, 0 answers
  1. Julian
    Julian avatar
    54 posts
    Member since:
    Apr 2015

    Posted 21 Apr 2015 Link to this post

    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!

  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 24 Apr 2015 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Julian
    Julian avatar
    54 posts
    Member since:
    Apr 2015

    Posted 24 Apr 2015 in reply to Maria Ilieva Link to this post

    Maria,

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

     Happy Friday :)

     

  5. Hiram
    Hiram avatar
    6 posts
    Member since:
    May 2015

    Posted 15 May 2015 Link to this post

    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";

    }

  6. Hiram
    Hiram avatar
    6 posts
    Member since:
    May 2015

    Posted 15 May 2015 in reply to Hiram Link to this post

    the last IF (outside the block) was an paste-error, look only the code inside the block
  7. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 19 May 2015 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017