RadGridView Distinct Filters stopped working after release 2022.2.511

3 Answers 203 Views
GridView
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Bob asked on 06 Sep 2022, 04:19 PM | edited on 06 Sep 2022, 04:26 PM

After installing release 2022.2.511, the distinct filters of our grid views stopped working.  We are using popup filters in a custom class with both distinct checkboxes and field filters visible.  Clicking on any distinct checkbox and then clicking Apply Filter button would always filter the grid, but after the 2022.2.511 release, clicking on distinct checkboxes and clicking Apply Filter now does nothing but close the filter popup with no effect to the results.  However, if the EnableDistinctValuesFiltering property is set to true, and some text is typed in the distinct search text box, and then the checkbox is checked and Apply Filter is clicked, the filtering works.

Is there some breaking change that was made that we should know about when dealing with distinct filters in the custom popup?  Is there any settings that we can try to help resolve this issue?

Thanks, Bob

3 Answers, 1 is accepted

Sort by
0
Accepted
Stenly
Telerik team
answered on 14 Sep 2022, 01:00 PM

Hello Bob,

I have contacted our developers' team regarding this behavior and we will consider it as a bug. As a result of this, a logged bug report regarding this matter can be found in our feedback portal. The public item could be found at the following link:

GridView: When distinct values are added dynamically the RadGridView is not filtered correctly based on them (telerik.com)

In addition, for bringing this to our attention, you could find your Telerik points updated.

With this said, I hope the provided information will be of help to you.

Regards,
Stenly
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Bob
Top achievements
Rank 3
Iron
Iron
Veteran
commented on 14 Sep 2022, 01:07 PM

Thank you Stenly!  We have modified our code to load the distinct values synchronously.  This is providing a working solution for now with a minor side affect of a small delay opening the popup.   Once the bug is fixed we can restore the asynchronous calls.
0
Stenly
Telerik team
answered on 09 Sep 2022, 12:14 PM

Hello Bob,

We had an exception that was occurring in regards to the FilteringControl element that is used in the RadGridView that was present in the 2022.2.511 version of our assemblies. It was fixed in the 2022.2.523 LIB version and the fix is also present in the 2022 R2 SP1 (the version for the service pack is 2022.2.621).

With this being said, would it be possible to the application that this behavior is present in with the 2022.2.621 version and see whether this is still present? If it, would it be possible to try and isolate this behavior in a sample project so that I could test it on my end and provide further information based on it?

Regards,
Stenly
Progress Telerik

The Premier Dev Conference is back! 

Coming to you live from Progress360 in-person or on your own time, DevReach for all. Register Today.


Bob
Top achievements
Rank 3
Iron
Iron
Veteran
commented on 09 Sep 2022, 12:49 PM

Hello Stenly,

I upgraded the version to 2022.2.621 and the issue is still there.  I noticed that if EnableDistinctValuesFiltering is enabled, and if any text is typed into the distinct search, even if the text is then cleared the filtering on the distinct values will work.  It is only on the initial load of distinct values that selecting any of them does not work.

It may be difficult to replicate how we use the filtering control in a sample application because we are using asynchronous server calls to load the distinct values, and we custom load the grid data one page at a time as needed.  When loading the distinct values, we override the DistinctValuesLoading event:

theGrid.DistinctValuesLoading += delDistinctValuesLoading = new EventHandler<GridViewDistinctValuesLoadingEventArgs>(GridHelper.HandleDistinctColumnValues);

The GridHelper.HandleDistinctColumnValues method will then call an asynchronous service to retrieve the distinct values for any data.  The return of this asynchronous call will then modify the collection.  Here is the code we are using to initiate the asynch call and handle the collection change:

 



        RadObservableCollection<object> cloneCollection;
        public void HandleDistinctColumnValues(object sender, GridViewDistinctValuesLoadingEventArgs e)
        {
            Assert.IsNotNull(_gridDataGetAllDistinctColumnValues);  // Delegate must be set for distinct column values

            if (e == null)
                throw new ArgumentNullException("GridViewDistinctValuesLoadingEventArgs");

            // Distinct Load as background operation to improve performance
            var column = (e.Column as DataBoundColumn);
            var dataType = column?.DataType;
            cloneCollection = new RadObservableCollection<object>();
            if (column?.ShowEmptyValueDistinctFilter == true)
                if (dataType == typeof(string))
                    cloneCollection.Insert(0, string.Empty);
                else
                    cloneCollection.Insert(0, FilterDescriptor.UnsetValue);
            e.ItemsSource = cloneCollection;
            var worker = new BackgroundWorker();
            worker.DoWork += new DoWorkEventHandler(worker_LoadDistinctValues);
            worker.RunWorkerAsync(e);

        }

        private void worker_LoadDistinctValues(object sender, DoWorkEventArgs e)
        {
            RadObservableCollection<object> collection = new RadObservableCollection<object>();
            collection.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(collection_CollectionChanged);

            GridViewDistinctValuesLoadingEventArgs args = (GridViewDistinctValuesLoadingEventArgs)e.Argument;

            if ((args.Column as DataBoundColumn).ShowDistinctFilters)
            {
                _gridDataGetAllDistinctColumnValues(args.Column.UniqueName, collection);
            }
        }

        void collection_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            bool bWorkDone = false;
            DispatcherHelper.CheckBeginInvokeOnUI(() =>
            {
                RadObservableCollection<object> originalColl = sender as RadObservableCollection<object>;
                if (originalColl.Count > 0)
                {

                    foreach (object o in sender as RadObservableCollection<object>)
                    {
                        if (!cloneCollection.Contains(o))
                            cloneCollection.Add(o);
                    }
                }
                bWorkDone = true;
            });

            while (!bWorkDone)
                Thread.Sleep(10);
        

Since I know that changing the search value in any way will allow the distinct filtering to work, I am going to try to programmatically modify the search value and then clear it to see if that can be used as a workaround.  Hopefully the insight into our code may help you figure out why this no longer works the same.

Thanks,

Bob

Stenly
Telerik team
commented on 14 Sep 2022, 12:13 PM

Thank you for your reply.
0
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
answered on 09 Sep 2022, 02:28 PM

I have determined that modifying the distinct collection on any type of delay is causing this issue.  Here is some sample code that will cause the distinct filters to not work for the filters that are added on the delay.  The first two filters will work, the second two will not.  This was working before the latest releases.


        RadObservableCollection<object> distinctFilterCollection;


        theGrid.DistinctValuesLoading += delDistinctValuesLoading = new EventHandler<GridViewDistinctValuesLoadingEventArgs>(HandleDistinctColumnValues);


        public void HandleDistinctColumnValues(object sender, GridViewDistinctValuesLoadingEventArgs e)
        {
            distinctFilterCollection= new RadObservableCollection<object>();
            distinctFilterCollection.Add("Distinct Filter 1");
            distinctFilterCollection.Add("Distinct Filter 2");

            e.ItemsSource = distinctFilterCollection;

            var worker = new BackgroundWorker();
            worker.DoWork += new DoWorkEventHandler(worker_LoadDistinctValues);
            worker.RunWorkerAsync(e);

        }

        private void worker_LoadDistinctValues(object sender, DoWorkEventArgs e)
        {
            Thread.Sleep(1000);  // Make sure there is some kind of delay to trigger the issue

            DispatcherHelper.CheckBeginInvokeOnUI(() =>
            {
                distinctFilterCollection.Add("Distinct Filter 3");
                distinctFilterCollection.Add("Distinct Filter 4");
            });

        }

Stenly
Telerik team
commented on 14 Sep 2022, 12:12 PM

I am currently reviewing this scenario and will reply in a couple of hours with additional information.
Tags
GridView
Asked by
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Answers by
Stenly
Telerik team
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Share this question
or