How to overwrite the FilterDistinctValues

6 posts, 0 answers
  1. Suping
    Suping avatar
    3 posts
    Member since:
    Apr 2012

    Posted 25 Apr 2014 Link to this post

    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
  2. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 28 Apr 2014 Link to this post

    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.
     
  3. DevCraft banner
  4. Suping
    Suping avatar
    3 posts
    Member since:
    Apr 2012

    Posted 28 Apr 2014 in reply to Yordanka Link to this post

    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.
  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 28 Apr 2014 Link to this post

    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.
     
  6. Suping
    Suping avatar
    3 posts
    Member since:
    Apr 2012

    Posted 28 Apr 2014 in reply to Dimitrina Link to this post

    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!
  7. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 30 Apr 2014 Link to this post

    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.
     
Back to Top
DevCraft banner