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

IColumnFilterDescriptor.FieldFilter.LogicalOperator working incorrect!!!

6 Answers 21 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Trần
Top achievements
Rank 1
Trần asked on 24 Sep 2015, 09:53 AM

Hello,
From tutorial http://docs.telerik.com/devtools/silverlight/controls/radgridview/filtering/programmatic.html
I have a small code sample which demonstrates above link.​ When I ​set IColumnFilterDescriptor.FieldFilter.LogicalOperator = Or. The data load correct. But after If i click AcctNo filter column then the ​combobox "LogicalOperator" is not update​(still load "And" default.....).

Here is the MainPage xaml:

<UserControl x:Class="SaveAndLoadFilterRadGridView.MainPage"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="400"
             xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
             xmlns:telerikPager="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Data">

    <Grid x:Name="LayoutRoot" Background="White">
        <telerik:RadGridView AutoGenerateColumns="False" ItemsSource="{Binding PendingCalls}" Name="dataGrid"
                                         SelectionMode = "Single" IsReadOnly ="True"
                                         Margin="10,0,10,0" MinHeight="200"
                                         Filtered="dataGrid_Filtered">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding InstitutionName, Mode=TwoWay}" Header="InstitutionName" IsReadOnly="True" Width="Auto" />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding AcctNo, Mode=TwoWay}" Header="AcctNo" IsReadOnly="True" Width="Auto" />
                <telerik:GridViewDataColumn DataMemberBinding="{Binding FullName, Mode=TwoWay}"  Header="FullName" IsReadOnly="True" Width="Auto" />
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
        <telerikPager:RadDataPager Margin="10,0,10,0" Grid.Row="1"  Source="{Binding  Items,  ElementName=dataGrid}"  PageSize="{Binding  CRMPageSize}" />
    </Grid>
</UserControl>

 

And the behind code MainPage.xaml.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.GridView;
using Telerik.Windows.Data;

namespace SaveAndLoadFilterRadGridView
{
    public partial class MainPage : UserControl
    {
        private ObservableCollection<DataTest> PendingCalls { get; set; }
        private IColumnFilterDescriptor AcctNoFilter { get; set; }

        public MainPage()
        {
            InitializeComponent();
            LoadDataToGrid();

            GridViewColumn acctNoCol = this.dataGrid.Columns["AcctNo"];
            AcctNoFilter = acctNoCol.ColumnFilterDescriptor;

            LoadFilterList();
        }

        private void dataGrid_Filtered(object sender, Telerik.Windows.Controls.GridView.GridViewFilteredEventArgs e)
        {
            #region Save To Database
            string operatorFilter1 = AcctNoFilter.FieldFilter.Filter1.Operator.ToString();
            string valueFilter1 = AcctNoFilter.FieldFilter.Filter1.Value.ToString();

            string logicalOperator = AcctNoFilter.FieldFilter.LogicalOperator.ToString();

            string operatorFilter2 = AcctNoFilter.FieldFilter.Filter2.Operator.ToString();
            string valueFilter2 = AcctNoFilter.FieldFilter.Filter2.Value.ToString();
            #endregion
        }

        private void LoadDataToGrid()
        {
            PendingCalls = new ObservableCollection<DataTest>() { new DataTest("Institu 1", "1", "Name 1"),
                                                                  new DataTest("Institu 2", "2", "Name 2"),
                                                                  new DataTest("Institu 3", "3", "Name 3"),
                                                                  new DataTest("Institu 4", "4", "Name 4"),
                                                                  new DataTest("Institu 5", "5", "Name 5")};

            this.dataGrid.ItemsSource = PendingCalls;
        }

        /// <summary>
        /// Load From Database
        /// </summary>
        private void LoadFilterList()
        {
            // Suspend the notifications to avoid multiple data engine updates
            this.dataGrid.FilterDescriptors.SuspendNotifications();

            #region AcctNoFilter
            AcctNoFilter.DistinctFilter.AddDistinctValue("1");
            AcctNoFilter.DistinctFilter.AddDistinctValue("2");

            AcctNoFilter.FieldFilter.Filter1.Operator = FilterOperator.IsNotEqualTo;
            AcctNoFilter.FieldFilter.Filter1.Value = "5";
            AcctNoFilter.FieldFilter.Filter1.IsCaseSensitive = true;

            // The logical operator between the two field filters.
            AcctNoFilter.FieldFilter.LogicalOperator = FilterCompositionLogicalOperator.Or;

            AcctNoFilter.FieldFilter.Filter2.Operator = FilterOperator.EndsWith;
            AcctNoFilter.FieldFilter.Filter2.Value = "2";
            AcctNoFilter.FieldFilter.Filter2.IsCaseSensitive = true;
            #endregion

            // Resume the notifications to force the data engine to update the filter.
            this.dataGrid.FilterDescriptors.ResumeNotifications();
        }
    }

    public class DataTest
    {
        public DataTest(string _InstitutionName, string _AcctNo, string _FullName)
        {
            InstitutionName = _InstitutionName;
            AcctNo = _AcctNo;
            FullName = _FullName;
        }

        public string InstitutionName { get; set; }
        public string AcctNo { get; set; }
        public string FullName { get; set; }
    }
}

 

I am using Telerik controls 2012.1.424.1040 in a Silverlight 4 project.

Please review code or see attach image.

Here are the steps to reproduce:

1/ Load filter data from database (LogicalOperator = Or)

2/ The data loaded correct

3/ Select filter from column AcctNo

4/ LogicalOperator combobox display value "And" - This is incorrect!!

 

Many thanks,

VietTQ

 

 

6 Answers, 1 is accepted

Sort by
0
Trần
Top achievements
Rank 1
answered on 28 Sep 2015, 01:46 AM
Can't Anyone Help Me?
0
Martin
Telerik team
answered on 29 Sep 2015, 09:15 AM
Hello Trần,

I have managed to reproduce the issue with the version 2012.1.424.1040. However, when i tried with our latest binaries everything worked as expected. The issue is fixed. If you download the latest binaries, the project should be working correctly.

I hope this helps.

Regards,
Martin Vatev
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
Trần
Top achievements
Rank 1
answered on 09 Oct 2015, 11:16 AM

Hello Martin

I downloaded and installed TelerikUIForSilverlightSetup_2015_2_728.exe from telerik site.

When I reference library from "C:\Program Files (x86)\Telerik\UI for Silverlight Q3 2015\Binaries\Silverlight" to my project(existed Telerik controls 2012.1.424.1040), I get error. The project cannot get reference. Please see attach image.

 Note: I referenced new dll: Telerik.Windows.Controls.GridView.dll, Telerik.Windows.Controls.dll, Telerik.Windows.Controls.Chart.dll, Telerik.Windows.Controls.Charting.dll, Telerik.Windows.Controls.Data.dll, Telerik.Windows.Controls.DataServices.dll, Telerik.Windows.Controls.DataVisualization.dll, Telerik.Windows.Controls.Input.dll, Telerik.Windows.Controls.Navigation.dll, Telerik.Windows.Data.dll

 

Can you send me guide for this apply.

 

Many thanks

0
Accepted
Martin
Telerik team
answered on 14 Oct 2015, 08:44 AM
Hi Trần,

Please take a look at Upgrading Telerik UI Trial to Telerik UI Developer License or Newer Version article in which we describe how to upgrade your controls to a newer version. But bear in mind that we have stopped maintenance of Silverlight 4.0 and if you want to use our latest binaries, your project should be Silverlight 5.0.

I hope this helps.

Regards,
Martin Vatev
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
Trần
Top achievements
Rank 1
answered on 17 Nov 2015, 04:28 AM
Hello, thanks very much, I get done at last version :D
0
Martin
Telerik team
answered on 17 Nov 2015, 07:27 AM
Hello,

I am really glad to see that you have succeeded to resolve the issue.
If further assistance is needed, please feel free to get back to us.


Regards,
Martin Vatev
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
Tags
GridView
Asked by
Trần
Top achievements
Rank 1
Answers by
Trần
Top achievements
Rank 1
Martin
Telerik team
Share this question
or