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

How to overwrite the FilterDistinctValues

5 Answers 98 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Suping
Top achievements
Rank 1
Suping asked on 25 Apr 2014, 01:20 PM
Hello , I use the grid view filteringmode ="FilterRow".

and my database object return a column type is Nullable<datetime>.

When I filter this column  is null  or is not null .

Till now, everything is fine,  but, when I start scroll the gridview,  throw the blow exception. I think the exception is came from FilterDistinctValues, so, when I use the FilterRow mode, I do not need  column distinct values, Can I overwrite or set property do not call GetDistinctValue ?

 System.InvalidOperationException: The binary operator NotEqual is not defined for the types 'System.Nullable`1[System.DateTime]' and 'System.Object'.
   at System.Linq.Expressions.Expression.GetEqualityComparisonOperator(ExpressionType binaryType, String opName, Expression left, Expression right, Boolean liftToNull)
   at System.Linq.Expressions.Expression.NotEqual(Expression left, Expression right)
   at Telerik.Windows.Data.Expressions.FilterOperatorExpressionBuilderBase.GenerateIsNotNull(Expression left)
   at Telerik.Windows.Data.Expressions.FilterOperatorExpressionBuilderBase.CreateExpression(Expression left, Expression right)
   at Telerik.Windows.Data.Expressions.OperatorValueFilterDescriptorExpressionBuilderBase.CreateBodyExpression()
   at Telerik.Windows.Data.FilterDescriptor.CreateFilterExpression(ParameterExpression parameterExpression)
   at Telerik.Windows.Data.FilterDescriptorBase.CreateFilterExpression(Expression instance)
   at Telerik.Windows.Data.Expressions.FilterDescriptorCollectionExpressionBuilder.CreateBodyExpression()
   at Telerik.Windows.Data.CompositeFilterDescriptor.CreateFilterExpression(ParameterExpression parameterExpression)
   at Telerik.Windows.Data.FilterDescriptorBase.CreateFilterExpression(Expression instance)
   at Telerik.Windows.Controls.GridView.FieldFilterDescriptor.Telerik.Windows.Data.IFilterDescriptor.CreateFilterExpression(Expression instance)
   at Telerik.Windows.Data.Expressions.FilterDescriptorCollectionExpressionBuilder.CreateBodyExpression()
   at Telerik.Windows.Data.CompositeFilterDescriptor.CreateFilterExpression(ParameterExpression parameterExpression)
   at Telerik.Windows.Data.FilterDescriptorBase.CreateFilterExpression(Expression instance)
   at Telerik.Windows.Controls.GridView.ColumnFilterDescriptor.CreateFilterExpression(Expression instance)
   at Telerik.Windows.Data.Expressions.FilterDescriptorCollectionExpressionBuilder.CreateBodyExpression()
   at Telerik.Windows.Data.Expressions.FilterExpressionBuilder.CreateFilterExpression()
   at Telerik.Windows.Data.QueryableExtensions.Where(IQueryable source, CompositeFilterDescriptorCollection filterDescriptors)
   at Telerik.Windows.Data.QueryableExtensions.Where(IQueryable source, IEnumerable`1 filterDescriptors)
   at Telerik.Windows.Data.QueryableExtensions.Where(IQueryable source, FilterDescriptorCollection filterDescriptors)
   at Telerik.Windows.Controls.GridViewColumn.FilterDistinctValues(IQueryable source)
   at Telerik.Windows.Controls.GridViewColumn.GetDistinctValuesQuery(IQueryable source, Boolean filter, Nullable`1 maximumValueCount)
   at Telerik.Windows.Controls.GridViewColumn.GetDistinctValuesCore(IQueryable queryableSource, Boolean filter, Nullable`1 maximumValueCount)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.GetDistinctValues(GridViewColumn column, Boolean filter, Nullable`1 maximumValueCount)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.GetDistinctValues(GridViewColumn column, Boolean filter)
   at Telerik.Windows.Controls.GridView.FieldFilterControl.RefreshContent()
   at Telerik.Windows.Controls.GridView.FieldFilterControl.set_Column(GridViewColumn value)
   at Telerik.Windows.Controls.GridView.GridViewHeaderCell.RefreshFiltering()
   at Telerik.Windows.Controls.GridView.GridViewHeaderCell.OnColumnChanged(GridViewColumn oldColumn, GridViewColumn newColumn)
   at Telerik.Windows.Controls.GridView.GridViewCellBase.set_Column(GridViewColumn value)
   at Telerik.Windows.Controls.GridView.GridViewCellsPanel.PrepareCell(GridViewCellBase cell, GridViewColumn column)
   at Telerik.Windows.Controls.GridView.GridViewCellsPanel.GetVirtualizedCell(GridViewColumn column, Boolean createIfNull)
   at Telerik.Windows.Controls.GridView.GridViewCellsPanel.RealizeAndMeasureCells(Int32 startIndex, Int32 predictedLastIndex, Func`2 calculateNext

5 Answers, 1 is accepted

Sort by
0
Yordanka
Telerik team
answered on 28 Apr 2014, 12:47 PM
Hi Suping,

I have tried to reproduce the problem you report but to no avail. Could you check the attached test project? Is there something specific in your case that I have missed? 
The project uses the latest official Telerik binaries.

Regards,
Yordanka
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Suping
Top achievements
Rank 1
answered on 28 Apr 2014, 01:58 PM
Hello  Yordanka,

Thanks your sample project,   I play with your demo project.
When I change  view model ,  public ObservableCollection<Club> Clubs  to   public VirtualQueryableCollectionView<Club> Clubs
even no data loaded (I did not check why no data)
I just drag the first column let the date column  is hidden (out of the screen)
the scroll the scrollbar , the Exception happened.
0
Dimitrina
Telerik team
answered on 28 Apr 2014, 02:43 PM
Hello,


I am afraid we are aware of this issue. It is an issue with the virtual collection and it is already logged as a bug report.
You can follow its progress in our Feedback Portal:
VQCV: exception on filtering with nullable DataTime bound value.

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Suping
Top achievements
Rank 1
answered on 28 Apr 2014, 03:36 PM
Thanks, It is bug for virtual collection.
But , I still considering why in this situation still fire GetDistinctValues ?
Is it any way can avoid GetDisitnctValues  when  RefreshContent  we set FilterMode == FilterRow ?
Because in my case, the data already there, and we do not need GetDistinctValues when I scroll the grid.
And I try OnGetDistinctValue and Set e.Cancel = true.  But Still does not work.
Any idea to help me avoid this exception before you fix the virtual collection issue?
Thanks!
0
Dimitrina
Telerik team
answered on 30 Apr 2014, 07:41 AM
Hello,

I am afraid the invocation of this method can not be stopped. It is executed no matter if the distinct values are shown on not on the FilteringControl.

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
Suping
Top achievements
Rank 1
Answers by
Yordanka
Telerik team
Suping
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or