We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Show Column Grand Totals but hide rows grand totals

Thread ID:

Created:

Updated:

Platform:

Replies:

143242 Mar 11,2019 01:39 PM UTC Mar 12,2019 07:13 AM UTC WPF 1
loading
Tags: PivotGridControl
Carlos Fernando Consigli
Asked On March 11, 2019 01:39 PM UTC

I'm using pivot grid in a very specific way and in some cases I just need to show column grand totals but hiding row grand totals. I can hide or show them both by using pivotGrid.ShowGrandTotals but I couldn't figure out how to to set them up separately. Is it possible to achieve that config?
Thanks in advance.

Arulraj A [Syncfusion]
Replied On March 12, 2019 07:13 AM UTC

Hi Carlos, 

Thanks for using Syncfusion product. 

We have analyzed the reported query “How to hide the row grand totals alone in pivot grid control”. You can achieve this requirement by invoking the RowHeights.SetHidden() method based on the grand total row index value. Also invoke the InvalidateCells method which is available in InternalGrid. If you want to hide the column grand totals alone, you can invoke the ColumnWidths.SetHidden method based on grand total column index value. You can find out the grand total row/column index value with the help of CellType property of PivotCellInfo. 
 
Note: ShowGrandTotals property is used to hide the both row and column grand totals in pivot grid. 

#MainWindow.xaml.cs 
 
        public MainWindow() 
        { 
            InitializeComponent(); 
            this.pivotGrid1.Loaded += PivotGrid1_Loaded; 
        } 
 
        private void PivotGrid1_Loaded(object sender, RoutedEventArgs e) 
        { 
            //To hide the row grand totals alone. 
            int row = this.pivotGrid1.PivotEngine.RowCount - 2; 
            PivotCellInfo cellInfo = this.pivotGrid1.PivotEngine.PivotValues[row, 0]; 
            if (cellInfo != null && cellInfo.CellType == (PivotCellType.RowHeaderCell | PivotCellType.GrandTotalCell)) 
            { 
                this.pivotGrid1.InternalGrid.Model.RowHeights.SetHidden(row, row, true); 
                this.pivotGrid1.InternalGrid.InvalidateCells(); 
            } 
 
            //To hide the column grand totals alone. 
            int col = this.pivotGrid1.PivotEngine.ColumnCount - this.pivotGrid1.PivotCalculations.Count - 1; 
            PivotCellInfo cellInfo1 = this.pivotGrid1.PivotEngine.PivotValues[0, col]; 
            if (cellInfo1 != null && cellInfo1.CellType == (PivotCellType.HeaderCell | PivotCellType.ColumnHeaderCell | PivotCellType.GrandTotalCell)) 
            { 
                for (int i = 0; i < this.pivotGrid1.PivotCalculations.Count; i++) 
                { 
                    this.pivotGrid1.InternalGrid.Model.ColumnWidths.SetHidden(col + i, col + i, true); 
                    this.pivotGrid1.InternalGrid.InvalidateCells(); 
                } 
            } 
        } 
 


Please let us know if you need any further assistance. 

Arulraj A 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon