Sorting only child rows in data bound RadGridView

1 Answer 83 Views
DataLayout GridView PageView
Richard
Top achievements
Rank 1
Richard asked on 01 Mar 2023, 04:50 PM

Hello!

My company is using RadGridView for an application where users can view and organize/edit SQL data. The grid is set to allow paging and up to 50 rows per page. Because of the size of some of the tables our users work with, the pages can number in the hundreds, which raises an issue when using the grid's built-in sorting capabilities. 

By default, the grid seems to sort all the data in the table as opposed to just the visible rows on screen. This results in a portion of data being displaying that is completely different from what is supposed to be on that page. What I'm looking to do is to have the grid sort only the child rows visible on the page.

I assume going the custom sort rout is necessary here? I've tried a bunch of different approaches to varying degrees of success, but nothing's gotten me quite there. The grid is data bound, which working around has been maybe the biggest hurdle for me so far. Ideally I'd like to be able to reorganize the rows on screen without having to rebind the grid, though I'm not sure how feasible that it. Regardless, any help is appreciated!

Best,

Rich

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 02 Mar 2023, 05:58 AM

Hello, Rich,

RadGridView supports client-side paging. Hence, RadGridView has a DataSource applied to it which stores all records and the data is represented in multiple pages.

According to the provided information, it is not clear enough how many records exactly you need to display in the grid. However, I would recommend you to consider using RadVirtualGrid which is a grid component developed on top of Telerik Presentation Framework which provides a convenient way to implement your own data management operations and optimizes the performance when interacting with large amounts of data. Additional information is available in the following help articles:
http://docs.telerik.com/devtools/winforms/virtualgrid/overview
http://docs.telerik.com/devtools/winforms/virtualgrid/sorting/sorting
http://docs.telerik.com/devtools/winforms/virtualgrid/paging/paging-overview

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.

Richard
Top achievements
Rank 1
commented on 03 Mar 2023, 05:04 PM

Hi Dess,

Thank you for your quick reply. Unfortunately, the project I'm working on is already making very heavy use of RadGridView and its properties, so to start using RadVirtualGrid at this point would mean we'd have to do some considerable restructuring. Is there any alternative that wouldn't require such drastic changes? To reiterate, I'm just looking to sort at most 50 child rows of column data at a time, and to have it only be the child rows displayed on the current page being sorted.

Thanks,

Rich

Dess | Tech Support Engineer, Principal
Telerik team
commented on 08 Mar 2023, 10:23 AM

Hi, Rich,

The current implementation of RadGridView is that the sorting functionality sorts all the data available in the DataSource collection and then the sorted records are split into pages. Sorting per page is not supported out of the box. 

The possible solution that I can suggest is to use the custom sorting functionality which allows you to implement your own logic for ordering the rows,e.g. within the page. Additional information how the custom sorting works is available here: https://docs.telerik.com/devtools/winforms/controls/gridview/sorting/custom-sorting 

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