[.NET Framework] C1FlexGrid with C1FullTextFilter and nested properties

Posted by: daniel.schoenbach on 29 May 2024, 4:38 pm EST

    • Post Options:
    • Link

    Posted 29 May 2024, 4:38 pm EST

    Hi,

    Does the C1FullTextFilter support searching columns with bindings to nested properties?

    i.e.

    <c1:Column Binding="{Binding Country.Name}" />

    Similarly, when sorting this column, will it be sorted by the values of the item, the Country value, or the Country.Name value?

    Thanks

  • Posted 30 May 2024, 8:31 am EST

    Hi Daniel,

    Thanks for reaching out to us with your query.

    Sorting and ColumnFilter works for the Nested properties on that column. But not working on the FullTextFilter feature.

    You can test with the attached sample: FlexGridFilterTest.zip

    This seems like a bug. So, we have escalated this issue to the development team. Will get back to you once we have any updates from the development team.[Internal tracking Id - C1XAML-36363]

    Regards,

    Nitin

  • Posted 30 May 2024, 11:36 am EST

    Thanks for the reply!

    I’m also curious if Converters are likewise supported for Filtering and/or Sorting. Will the unconverted or converted value be used by FullTextFilter? What about when sorting?

    e.g.

    <c1:Column Binding="{Binding Path=CountryID, Converter={StaticResource CountryConverter}}" />
    or
    <c1:Column Binding="{Binding Path=CountryID}" ValueConverter="{StaticResource CountryConverter}" />

  • Posted 31 May 2024, 5:05 am EST

    Hi Daniel,

    As per the development team, This is a limitation in the implementation of the FlexGrid filter.

    The UpdateFilterInfos method of C1FullTextFilter, which performs the filtering, is based on Column.DataType, and this property is based on PropertyInfo property of Column, and this property is only set for simple properties and is null for nested properties.

    But you can use Binding Converters to achieve your requirements. Sorting, Filtering and FullTextFiltering will work.

    Please refer the attached modified sample for the same: FlexGridFilterTest_Mod.zip

    Best Regards,

    Nitin

  • Posted 3 June 2024, 12:12 pm EST - Updated 3 June 2024, 12:54 pm EST

    Thanks again for the reply.

    That’s unfortunate to hear, as binding directly to the nested properties would be more convenient.

    I don’t think the FlexGrid works with converters as you are describing either. I’ve put together a small sample. It demonstrates 3 issues:

    1. Non-visible columns are still checked by the FullTextFilter. (This could actually be a useful feature, so it may be intended and not a bug.)

    2. Columns bound to nested properties are not searched by FullTextFilter (as described above). However, the columns do sort properly, using the correct values from the nested property.

    3. Columns using a converter are searched by FullTextFilter. However, the columns do not sort properly, using the unconverted value.

    FlexGridFilterIssues.zip

    		<!-- ISSUE 1: Uncomment this and search for a country name.
                                  The column is not visible, but is included in the search. -->
                    <!--<c1:Column Binding="{Binding Path=CountryName, Mode=OneWay}" Visible="False" />-->
    
                    <!-- ISSUE 2: Comment the above and uncomment this.
                                  Sorting works, but full text filtering does not. -->
                    <!--<c1:Column Binding="{Binding Path=Country.Name, Mode=OneWay}" />-->
    
                    <!-- ISSUE 3: Comment the above and uncomment either.
                                  Full text filtering works, but sorting does not. -->
                    <!--<c1:Column Header="BindingConverter" Binding="{Binding Path=CountryID, Mode=OneWay, Converter={StaticResource CountryConverter}}" />-->
                    <!--<c1:Column Header="ValueConverter" Binding="{Binding Path=CountryID, Mode=OneWay}" ValueConverter="{StaticResource CountryConverter}" />-->
  • Posted 4 June 2024, 8:37 am EST

    Hi,

    1. FullTextFilter checks for all columns of the FlexGrid even it is hidden/visible.
    2. As per the development team and mentioned earlier, The UpdateFilterInfos method of C1FullTextFilter, which performs the filtering, is based on Column.DataType, and this property is based on the PropertyInfo property of Column, and this property is only set for simple properties and is null for nested properties. hence FullTextFilter doesn’t work in this case.
    3. Sorting works for the Binding path. This is the design behavior. For your use case, you can sort the CountryName as per the CountryId. So, the Country name will be sorted in the frontend while in the background it is CountryId.

      Please refer the attached modified working sample: FlexGridFilterIssues_Mod.zip

    Regards,

    Nitin

  • Posted 4 June 2024, 2:02 pm EST

    For the benefit of future readers, I tried setting PropertyInfo manually for a nested property, but this breaks sorting since the FlexGrid tries to read that property on the bound object. (e.g. The binding for Person.Country.Name is ignored and it looks for Person.Name.)

    Since I need both filtering and sorting, I’m left with the conclusion that I must make a “flat” wrapper/ViewModel object with my desired properties. Nested properties aren’t currently supported. I’m not familiar enough with how the WPF binding engine handles it.

  • Posted 5 June 2024, 8:02 am EST

    Hi Daniel,

    Yes, you need to customize these to support Sorting and FullTextFilter. This is a limitation of FulltextFilter to work with nested properties. It actually gets the null for the nested properties.

    Regards,

    Nitin

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels