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. Image for the cookie policy date

PivotGridControl Filters changed event

Hi,

I have a PivotGridControl with a PivotTableFieldList. If the user changes the setup of the Grid and adds a field to the Report Filter, I can catch the change of PivotFilters but NOT the changes in the content of the PivotFilter.

Let's say I have multiple years in a field and the user deselects on of the years (for instance 2014, 2015 but NOT 2016) -> how can I catch that event?

Thanks!

Cheers,

Matthijs

3 Replies

MG Mohanraj Gunasekaran Syncfusion Team February 20, 2017 11:47 AM UTC

Hi Matthijs, 
 
Thanks for using Syncfusion products. 
 
In order to get the filtered value, you can use the Expression property in Filters.CollectionChanged event. Please refer the below code example and refer the below attached sample, 
 
Code example 
AddHandler Me.pivotGridControl1.Filters.CollectionChanged, AddressOf Filters_CollectionChanged 
Private Sub Filters_CollectionChanged(ByVal sender As Object, ByVal e As System.Collections.Specialized.NotifyCollectionChangedEventArgs) 
    If e.NewItems IsNot Nothing AndAlso TypeOf e.NewItems(0) Is FilterExpression Then 
        Dim expression As FilterExpression = TryCast(e.NewItems(0), FilterExpression) 
        Dim filteredvalue() As String = expression.Expression.Split(New String() { "||" }, StringSplitOptions.None) 
        Dim values As String =Nothing 
        For Each value As String In filteredvalue 
             values &= value.Replace(expression.DimensionName, String.Empty).Replace("=", String.Empty)+ Constants.vbCrLf 
        Next value 
    End If 
End Sub 
 
Sample link: PivotGridControl 
 
Please let us know if you have any further assistance. 
 
Regards, 
Mohanraj G. 



MH Matthijs Huisman February 20, 2017 02:12 PM UTC

Hi,

Thank you for your answer, but you helped me already with your other post (id 128966)! The PivotSchemaDesigner.SchemaChanged event was the key -> this event fires when a filter expression is changed as well!

NB: the event you describe here only fires when an expression is added or removed from the filtercollection but (as far as I can tell from what I tried) it does NOT fire when the content of an expression is changed. But again the SchemaChanged event helped me out!

Thank you!


MG Mohanraj Gunasekaran Syncfusion Team February 21, 2017 03:41 PM UTC

Hi Matthijs,  
 
Thanks for your update. 
 
We are glad to know that your reported problem has resolved. 
 
Please let us know, if you have any further assistance. 
 
Regards, 
Mohanraj G. 


Loader.
Up arrow icon