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

GridEventHandler_SelectionChanging Taking long time.

5 Answers 32 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Raju
Top achievements
Rank 1
Raju asked on 17 Apr 2017, 12:09 PM

Hi,

    i am facing the issue with radgridview. i.e GridEventHandler_SelectionChanging method is taking  more than 45 seconds of time to go to GridEventHandler_SelectionChanged events. can any one have solutions?

5 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 18 Apr 2017, 10:24 AM
Hi Raju,

The provided information is not sufficient for us to determine what is causing such delay. In addition, we do not have any other reports of similar behavior. Would it be possible for you to send us the code that you are using in the SelectionChanging event handler? Are you performing any other actions while the selection is changed?

Which is the exact version of the suite that you are currently using?

Thank you in advance for your patience and cooperation. 

Regards,
Dimitar
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Raju
Top achievements
Rank 1
answered on 18 Apr 2017, 11:09 AM

Hi,

Please find the details below.

We are using telerik product version 2013.1.0507.40.

We are selected around 4000+ ducuments using the shift key within the RadGridView.
Now if we click on any selected row, it takes upto 45 seconds before these documents to become unselected and the single document to become selected again. (During these 45 seconds the application is in freeze state).
We noticed that the delay is occuring when the control navigates from  GridEventHandler_SelectionChanging event to GridEventHandler_SelectionChanged event.
We have the code below for both the events.
private void GridEventHandler_SelectionChanging(object sender, SelectionChangingEventArgs e)
        {
            using (new FunctionTimer())
            {
                var docVM = Grid.DataContext as DocumentListViewModel;
                if (docVM != null)
                {
                    try
                    {
                        //when grid is in column grouping mode and shift click multiselection
                        if (Grid.GroupDescriptors.Count > 0 && Keyboard.Modifiers == ModifierKeys.Shift)
                        {
                            IoC.Get<IWindowManagerEx>().NotifyModal(Resources.SelectAllColumnGroupingMessage, MessageBoxImage.Information);

                            // disable the Shift+Click selection
                            e.Cancel = true;
                        }

                        //var clickedRow = (e.OriginalSource as UIElement) != null ? (e.OriginalSource as UIElement).ParentOfType<GridViewRow>() : null;
                        // when the grid is in 'Select All' mode we need to detect ctrl+click and shift+click operations and disable them
                        else if (IsSelectAllMode)
                        {
                            // check if requested selection is a simple single click
                            if (Grid.SelectedItems.Count + e.AddedItems.Count - e.RemovedItems.Count == 1)
                            {
                                // allow single click which will turn off 'Select All' mode.
                                return;
                            }

                            IoC.Get<IWindowManagerEx>().NotifyModal(Resources.SelectAllModeRowSelectMsg, MessageBoxImage.Information);

                            // disable the Ctrl+Click and Shift+Click selection
                            e.Cancel = true;
                        }
                        else
                        {
                            ISelectAllMode handler = _actionHandler as ISelectAllMode;
                            if (handler != null)
                            {
                                if (
                                    handler.DisallowItemSelection(_numSelectedRows == -1
                                                                    ? this.Grid.SelectedItems.Count + e.AddedItems.Count - e.RemovedItems.Count
                                                                    : _numSelectedRows) == true)
                                {
                                    e.Cancel = true;
                                }
                            }
                        }
                    }
                    finally
                    {
                        //this.LogTrace("GridEventHandler_SelectionChanging: setting halt to false");
                        _numSelectedRows = -1;
                        if (docVM.IsHaltLoadingDocs)
                        {
                            docVM.DocToSelectAfterUnHalted = this.Grid.SelectedItem as Document;
                            docVM.RowToSelectAfterUnhalted = this.Grid.Items.IndexOf(docVM.DocToSelectAfterUnHalted);
                            docVM.IsHaltLoadingDocs = false;
                        }
                    }
                }
            }
        }

private void GridEventHandler_SelectionChanged(object sender, SelectionChangeEventArgs e)
        {
            using (new FunctionTimer())
            {
                Grid.Focus(); // Required to ensure that data binding works correctly in coding panel when changing the current document selection via mouse or keyboard
                var rowIndex = Grid.Items.IndexOf(Grid.SelectedItem);
                IoC.Get<DocumentListViewModel>().SelectedRowIndex = rowIndex;
                ((ISelectable)_actionHandler).SelectionChanged(e.AddedItems, e.RemovedItems);
            }
        }

 

Thanks,

Raju

0
Dimitar
Telerik team
answered on 19 Apr 2017, 06:35 AM
Hello Raju,

I cannot find an official release with the specified version. Could you please check this again?

In addition which is the exact product that you are using?

I am looking forward to your reply.

Regards,
Dimitar
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Raju
Top achievements
Rank 1
answered on 19 Apr 2017, 01:20 PM

Hi Dimitar,

We are using Telerik Windows WPF version 2013.1.507.40.

and also i have attached snapshot of dll version for reference.

0
Stefan
Telerik team
answered on 24 Apr 2017, 07:54 AM
Hello Raju,

Thank you for the clarification.

I tested the selection performance with the version you are using and I was not able to reproduce such issue with similar setup. May I ask you to try removing the logic implemented within the SelectionChanging event handler? Is the issue still reproducible on your end?

Best Regards,
Stefan X1
Telerik by Progress
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.
Tags
General Discussions
Asked by
Raju
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Raju
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or