sort on total row

Good morning, 

i would like if there is a way to sort the results on the total rows .

I'm talking about the values inside the red square in the image below.

sorted on total row pivotgrid.png

In the sort option that i can find, there is the way to sort for the sub total but what i need , in the image above, is to see car records before bike records if i want to sort the totals from the smallest to the biggest.

Is it possibble?

Thank You inadvance


6 Replies 1 reply marked as answer

TB Thirupathi Bala Krishnan Syncfusion Team December 15, 2021 07:23 PM UTC

Hi Marco,  
 
Thanks for contacting Syncfusion support. 
 
We have analyzed your reported query “if there is a way to sort the results on the total rows”. Yes, you can sort the subtotals from smallest to largest. In general, Pivot Grid will populate the data in ascending order by default with numeric string sorting. Sorting the data with your own custom comparer can be achieved by defining the custom comparer and initializing its instance to the Comparer property of the corresponding PivotItem. 
 
If you want to sort the values based on the Pivot Item (PivotRows/PivotColumns headers), Please follow the below steps in your application. 
  • Define the custom ReverseOrderComparer.
  • To apply this comparer to PivotItem, an instance for the ReverseOrderComparer is created and assigned it to the Comparer property of the Product PivotItem.
 
The Grouping bar should be used if you wish to sort the values based on the PivotRows/PivotColumns headers during runtime. Grouping bar allows you to perform sorting, filtering, and summarizing of data the way a user wants at runtime. Each item contains Caption, Filterbutton and Sort indicator. Sorting should be performed if the grouping bar toggle button is clicked. 
 
For more details, please refer our UG documentation from the following link: 
 
Pivot Grid control provides Excel-like sorting and filtering features applied to a pivot item. You can enable or disable the Excel-like sorting and filtering pop-up in the pivot grid by setting the AllowMultiFunctionalSortFilter property of grouping bar in the pivot grid control. 
 
If you want to sort the values based on the subtotals. Please follow the below steps in your application.  
  • Define the pivot grid control and raise the loaded event for pivot grid.
  • Inside the PivotGrid_Loaded() event, raise the loaded event for the grouping bar.
  • Inside the GroupingBar_Loaded() event, set the value of the AllowMultiFunctionalSortFilter property to “true”.
  • Click the Filter icon for the Product and select More Sort Options.
  • Click Ascending (A to Z) by or Descending (A to Z) by, and then choose the field you want to sort(Quantity/Amount).
 
Please refer the following code sample. 
 
# MainWindow.xaml.cs

 
        public MainWindow() 
        { 
            InitializeComponent(); 
            this.pivotGrid1.Loaded += PivotGrid1_Loaded; 
        } 
 
        private void PivotGrid1_Loaded(object sender, RoutedEventArgs e) 
        { 
            pivotGrid1.GroupingBar.Loaded += GroupingBar_Loaded; 
        } 
 
        private void GroupingBar_Loaded(object sender, RoutedEventArgs e) 
        { 
            pivotGrid1.GroupingBar.AllowMultiFunctionalSortFilter = true; 
        }

 
 
Please refer the attached videos from the following location: 
 
 
Please let us know if you need any further assistance. 
 
Regards, 
Thirupathi B. 


Marked as answer

MD marco del frate replied to Thirupathi Bala Krishnan January 25, 2022 10:03 AM UTC

Good morning,


sorry for late. This is exactly what i was seraching for.


Thank You very much


Best regards




MD marco del frate January 25, 2022 03:12 PM UTC

Good evening,


i'm sorry but now there is a new problem.

The sorting works as i requested: the problem is that once i sorted on a second column, the vertical scroll bar disappear and i can't scroll nomore.

I think it's a sort of visualization bug.


i've attached a zipped gif to show you the problem


Can you help me, please?

 


Attachment: vertical_scroll_bar_1f1b848d.rar


TB Thirupathi Bala Krishnan Syncfusion Team January 26, 2022 09:08 AM UTC

Hi Marco, 

Please find our response as below, 

Query 
Response 
This is exactly what i was seraching for. 
We are glad to know that the provided solution resolved your reported scenario at your end.  

The sorting works as i requested: the problem is that once i sorted on a second column, the vertical scroll bar disappear and i can't scroll nomore. 
We were unable to reproduce the reported issue "Vertical scrollbar did not display after filtering the pivot rows item" on our end. 

By default, horizontal and vertical scrollbars should be displayed based on the Pivot grid column and row count values. If the row count value was less than the actual pivot grid height, the vertical scrollbar was not displayed. If the row count value is more than pivot grid height, the vertical scrollbar will be enabled automatically. 

Please refer to the attached videos from the following link: 


Could you please check the issue in aforementioned sample and let me know whether or not the reported issue has been resolved? If you are still experiencing the same problem, could you please share your working sample or modify the attached sample to reproduce the reported issue we can provide a solution as soon as possible? 


Please let us know if you need any further assistance. 

Regards, 
Thirupathi B. 



MD marco del frate replied to Thirupathi Bala Krishnan January 26, 2022 10:25 AM UTC

Good moring,

i tryed Your sample and the main difference i can see is that Your Itemssource is a viewmodel class while in my caseis a table from a dataset. Anyway i removed the following option:

   ResizePivotGridToFit="True"

and now it works. The vertical scrollbar remains 


Thank You

Best regards




TB Thirupathi Bala Krishnan Syncfusion Team January 26, 2022 10:58 AM UTC

Hi Marco, 

Thank you for confirming that the reported issue was resolved on your end. Please let us know if you need any further assistance on this. As always, we are happy to assist you. 

Regards, 
Thirupathi B. 


Loader.
Up arrow icon