Gridview Paging Grouping

2 Answers 168 Views
GridView
James
Top achievements
Rank 1
Veteran
James asked on 17 Mar 2022, 01:59 PM | edited on 18 Mar 2022, 03:22 PM

There seems to be an issue expanding/collapsing the first grouped row on a different page.

If I collapse or expand the 1st row on the first page, it behaves normally. However, if I navigate to the 2nd page and attempt to expand or collapse the first row, the RadGridview changes the page to the first page. Collapsing or expanding any other row on the 2nd page works as designed.

If I navigate to the fourth page and expand the first row, it changes to the third page and expands the first row on that page.

The application is quite complicated. So, the best I can do is display screenshots. I will try to create a test application. Perhaps, I am missing something.

 

If I were to navigate to page 2 and expand row 1, it would change to page 1 and expand the first row on page 1.

 

I attached a video of the behavior.

Thank you for any help.

 

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 24 Mar 2022, 07:07 AM
Hello, James,

As the property name (PagingBeforeGrouping) speaks for itself, it controls which operation will be executed over the data rows first. If the PagingBeforeGrouping is enabled, the paging operation will be performed first and then only the rows on the respective page will be grouped. Otherwise, the rows will be grouped first considering all the data rows inside the grid and then the grouped rows will be divided into pages. Thus, each group will have all of the associated rows.

After further testing and deeper investigation, I confirm that it is an issue with the grouping before paging functionality when expanding the top group row of a page with index greater than 0.  

I have logged it in our feedback portal by creating a public thread on your behalf. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to cancel the page changing while expanding the top group row on a page. I have prepared a sample code snippet for your reference:

        public class CustomGrid : RadGridView
        {
            public override string ThemeClassName
            {
                get
                {
                    return typeof(RadGridView).FullName;
                }
            }
            protected override void OnMouseDown(MouseEventArgs e)
            {
                GridExpanderItem expander = this.ElementTree.GetElementAtPoint(e.Location) as GridExpanderItem;
                if (expander != null)
                {
                    flag = true;
                }
                base.OnMouseDown(e);
            }

            protected override void OnMouseUp(MouseEventArgs e)
            {
                base.OnMouseUp(e);
                flag = false;
            }

            bool flag = false;

            protected override void OnPageChanging(object sender, PageChangingEventArgs e)
            {
                if (flag)
                {
                    e.Cancel = true;
                } 
                base.OnPageChanging(sender, e);
                
            }
        }

This seems to work as expected on my end:

Please give it a try and see how it works on your end.

Regards,
Dess | Tech Support Engineer, Principal
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.

James
Top achievements
Rank 1
Veteran
commented on 24 Mar 2022, 01:23 PM

Hello Dess,

Thanks for following up. I appreciate it.

Your workaround is more elegant than mine. I'll use your solution instead of mine. Thank you.

Best Regards,

Jim

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 21 Mar 2022, 12:08 PM
Hello, James,

Following the provided information, I have prepared a sample project to test expanding a row when grouping is combined with paging. Indeed, in this case, the page index gets changed. However, it is necessary to specifically set the PagingBeforeGrouping property to true
 this.radGridView1.MasterTemplate.DataView.PagingBeforeGrouping = true;

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
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.

James
Top achievements
Rank 1
Veteran
commented on 21 Mar 2022, 12:56 PM

The PagingBeforeGrouping solution doesn't work for me because I want all grouped rows in ascending order regardless of their page. With PagingBeforeGrouping, they are only in ascending order on the specific page.

I looked through some of the Telerik code and I believe I identified an issue in the GridVisibilityHelper.EnsureRowVisible method. I believe the incorrect rowInfo object is passed into the method and that row index is on the previous page only when the first group row is expanded on a page greater than 1.

I am still researching the Telerik code a bit more. But, as I stated, whenever the first grouped row on a page greater than 1 is expanded or collapsed, the control collapses or expands the first grouped row on the previous page. So, if I expand GroupedRow index 0 on page 3, the control reverts to page 2 and expands page 2's GroupedRow index 0.

Expanding or Collapsing any other GroupedRow index greater than zero on a page greater than 1 works just fine. It is only the GroupedRow index 0 on a page greater than 1 that behaves this way.

I will investigate more and post my findings.

 

James
Top achievements
Rank 1
Veteran
commented on 21 Mar 2022, 07:21 PM

Attached, please find a test project that demonstrates the issue.

Procedure:

1 - Navigate to page 1.

2- Expand/Collapse any grouped row. It should expand and collapse correctly.

3 - Navigate to page 2.

4 - Expand/Collapse any grouped row except the top row. They should expand and collapse properly.

5 - Expand/Collapse the top grouped row on page 2. It will navigate to page 1 and may expand or collapse the top grouped row on page 1 instead of page 2.

6 - Expand/Collapse the top grouped row on page 3. It will navigate to a different page than page 3 even though the rest of the grouped rows function correctly.

 

James
Top achievements
Rank 1
Veteran
commented on 23 Mar 2022, 03:10 AM

Hi Dess,

Just one more issue. When you click any child cell (not the expander cell) in the first expanded group on any page other than page 1, the pageindex changes to zero.

Clicking on the cell where the mouse caret is will change the pageindex to 0.

 

Tags
GridView
Asked by
James
Top achievements
Rank 1
Veteran
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or