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

Exception filtering numeric column

Hi,

I am binding a DynamicDictionary to a SFTreeGrid. This works fine so far.
I am converting the columns to the right type using the 
AutoGeneratingColumn event like this:

Private Sub treeGridSearchResult_AutoGeneratingColumn(sender As Object, e As TreeGridAutoGeneratingColumnEventArgs) Handles treeGridSearchResult.AutoGeneratingColumn
        If e.Column.MappingName.Contains(" (N)") Then
            If TypeOf e.Column Is TreeGridTextColumn Then
                Dim headername As String = e.Column.MappingName
                e.Column = New TreeGridNumericColumn() With {
                    .MappingName = headername,
                    .NumberDecimalDigits = 4,
                    .AllowNullValue = True,
                    .AllowFiltering = True
                }
            End If
        End If
End Sub

In my SFTreegrid the data is correctly shown, also the 4 digits for the numeric columns are visible as expected.

But if I use the filter function and define a filter e.g. "less then 400", then I get an exception shown below. It seems that the data in the column is still handled as string, but not as numeric.

error.jpg

Can you please check.

Thank you and kind regards 



3 Replies

SP Sreemon Premkumar Muthukrishnan Syncfusion Team January 27, 2023 01:59 PM UTC

Hi Marco Uffelmann,


By Default in SfTreeGrid, the filter for a column will be loaded based upon the underlying property type. As in your scenario, the underlying property of the column is string type, so text filter will be loaded. However you can use programmatic filtering to filter the data.

For more information about the programmatic filtering, please check the below user guide documentation

UG link: https://help.syncfusion.com/wpf/treegrid/filtering#view-filtering

We have prepared the simple sample based on your scenario, please find the sample in the attachment 

If we misunderstood your requirement, provide more information related to your query?

  1. Video illustration of the reported issue
  2. Details about your scenario with image illustrations?

It will be helpful for us to check on it and provide you the solution at the earliest

Regards,

Sreemon Premkumar M.


Attachment: SfTreeGrid_Numeric_b53c9cef.zip


MU Marco Uffelmann January 27, 2023 02:28 PM UTC

Hi Sreemon Premkumar M.


with datetime field it is working just the way I described above. 

I just have to define the column as a TreeGridDateColumn and it automatrically recognize the date and use it as date during filtering.

I was wondering that this also works for numeric.

With your example there would be another button for filtering and I cannot use the filtering button in the standard popup.

Is there any way to handle that without an extra b





SJ Sathiyathanam Jeyakumar Syncfusion Team January 30, 2023 04:53 PM UTC

Marco Uffelmann,

We apologize for not being able to understand your requirements clearly. To provide you with an accurate solution, could you please provide more details and specify your requirement precisely? Regarding your inquiry, by default, the columns in TreeGrid are created based on the underlying property type. The same is applicable to filtering. If the property type is DateTime, the column will be created as a DateTime column, and its filter will be set as a DateFilter.

Refer to the below links to get more details about filtering.

https://help.syncfusion.com/wpf/treegrid/filtering#filterlevel

https://help.syncfusion.com/wpf/treegrid/filtering#ui-filtering

https://help.syncfusion.com/wpf/treegrid/filtering#instant-filtering

https://help.syncfusion.com/wpf/treegrid/filtering#customizing-filter-predicates


Loader.
Up arrow icon