This is a migrated thread and some comments may be shown as answers.

Missing Property causes Filtering and Sorting to no longer work

7 Answers 163 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 30 Dec 2015, 04:15 PM

I'm using RadGridView to show certain properties of a list of elements.
This works as expected as long as all elements in the list have all properties the columns bind to.

But once only one element does not have a property a column binds to the whole columns fails to correctly support sorting and filtering.

When sorting no element is shown at all and the filter dialog does not show any values. See attached screenshots.

This still happens even though a FallbackValue of the right type is provided in the Binding.

 

Is there a way to make this work? Sadly I can not avoid having some elements that do not implement all properties, so a failing binding most be handled in a better way. 

 

My Xaml:

<Window x:Class="WpfTestApplication.MainWindow"
        xmlns:telerikG="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
        xmlns:telerikD="clr-namespace:Telerik.Windows.Data;assembly=Telerik.Windows.Data"
        Title="MainWindow" Height="200" Width="300">
    <Grid>
        <telerikG:RadGridView ItemsSource="{Binding Elements}" AutoGenerateColumns="False">
                <telerikG:RadGridView.Columns>
                <telerikG:GridViewDataColumn Header="cost" DataMemberBinding="{Binding cost, FallbackValue=0.0}"/>
                </telerikG:RadGridView.Columns>
            </telerikG:RadGridView>
    </Grid>
</Window>

7 Answers, 1 is accepted

Sort by
0
Stefan Nenchev
Telerik team
answered on 04 Jan 2016, 08:35 AM
Hello Peter,

I have tried reproducing the issue you have described but was not able to. I have recorded the behavior and you can review it at http://screencast.com/t/l26cmAGhI. Can you please provide some more information regarding the setup at your end and more specifically the data source for the grid? 

I have also created a sample project for you. Would it be possible to modify it so that it represents the undesired behavior and send it over so I can have a more detailed look and hopefully find the root of the issue? 

I am looking forward to your reply, Peter.

Regards,
Stefan Nenchev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Peter
Top achievements
Rank 1
answered on 04 Jan 2016, 09:37 AM

Hello Stefan,

I was able to modify your example.
You just set a property to null. But my Problem is triggered when a object is off a different type has does not have a certain property at all.

The problem is probably also related to the fact that our models use the ICustomTypeDescriptor interface to expose properties at runtime.

 

Regards,
Peter Grüner

0
Frazz Jarvis
Top achievements
Rank 1
answered on 15 Jun 2017, 04:32 PM

Hi Peter/Stefan,

Old post I know but I'm currently having a very similar problem (null values in runtime-generated columns causing sort and filter to fail as described in Peters's original post/screenshots).  I'm using ExpandoObject to create the column data. Grid sorts/filters perfectly if a column has no null values BTW.

Currently using build 2017.2.614.

Any help would be much appreciated.

Best regards,

Frazz

0
Stefan
Telerik team
answered on 20 Jun 2017, 11:39 AM
Hi Peter,

The issue reported in this thread rooted in the fact, that there were missing properties in the bound item that the data engine of RadGridView is searching for. The malfunction in such case would be the expected one. However, you stated setting null values instead, which is supported for an object implementing IDynamicMetaObjectProvider. With this in mind, can you please clarify whether you are simply setting a null value to a given property of the ExpandoObject, or you are defining columns that are bound to a property that is not present in the bound item?

Best Regards,
Stefan X1
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Frazz Jarvis
Top achievements
Rank 1
answered on 20 Jun 2017, 01:49 PM

Hi Stefan,

Thanks for your reply.  Makes sense re missing properties (I had jagged data).  Removing the jaggedness solves my problem.  I still have issues with filtering due to the use of dynamic properties and I presume this is still an issue (highlighted in a previous post of yours regarding dynamic data - http://www.telerik.com/forums/binding-radgridview-with-dynamic-column)?

Best regards,

Frazz

0
Stefan
Telerik team
answered on 23 Jun 2017, 01:17 PM
Hi Frazz,

Firstly, please, excuse me for mistaking you with the previous user in this thread.

As to the issue you are experiencing, I am not completely sure what it is. Note, that if it is related to the filter operators that are generated for a dynamic type, as discussed in the forum thread to which you referred, this would be the expected behavior. Can you please clarify this?

Regards,
Stefan X1
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Frazz Jarvis
Top achievements
Rank 1
answered on 23 Jun 2017, 03:25 PM

Hi Stefan,

No worries re name :).  Yep, I guess I'm saying that I do indeed have the issue with the default filtering options in regard to dynamic types so will probably implement a custom filter to get around that.  Thanks for the help regardless.

Frazz

Tags
GridView
Asked by
Peter
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
Peter
Top achievements
Rank 1
Frazz Jarvis
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or