How to determine if a pivotrow column header has been reordered

Is there an event that I can use that will let me know if the PivotRow headers have been rearranged by dragging the column header to a different position? I am working in vb and I have not been able to find an event. I want to change which PivotRow has subtotals based on the new order of the row columns.

1 Reply

DV Duraimurugan Vedagiri Syncfusion Team May 7, 2020 04:10 PM UTC

Hi George,

Thanks for using syncfusion products.

Query : Is there an event that I can use that will let me know if the PivotRows have been rearranged by dragging the column header to a different position?

You Can achieve the reported requirement with help of PivotRows or PviotColumns CollectionChanged event handler. Please refer the below code snippet for your reference.

Public Sub New() 
    InitializeComponent() 
    AddHandler pivotGridControl1.PivotRows.CollectionChanged, AddressOf pivotGridControl1_Row_CollectionChanged 
    AddHandler pivotGridControl1.PivotColumns.CollectionChanged, AddressOf pivotGridControl1_Col_CollectionChanged 
End Sub 
 
Private Sub pivotGridControl1_Col_CollectionChanged(sender As Object, e As NotifyCollectionChangedEventArgs) 
    Console.WriteLine(e.Action) 
    Console.WriteLine(e.OldStartingIndex) 
    Console.WriteLine(e.NewStartingIndex) 
End Sub 
 
Private Sub pivotGridControl1_Row_CollectionChanged(sender As Object, e As NotifyCollectionChangedEventArgs) 
    Console.WriteLine(e.Action) 
    Console.WriteLine(e.OldStartingIndex) 
    Console.WriteLine(e.NewStartingIndex) 
End Sub 

Regards,
Durai
 



Loader.
Up arrow icon