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

Self-referencing hierarchical grid with pagination at the database level.

5 Answers 279 Views
Grid
This is a migrated thread and some comments may be shown as answers.
PSCU Developers
Top achievements
Rank 1
PSCU Developers asked on 25 Jan 2011, 03:56 PM
I've done quite a bit of searching and cannot find an example of self-referencing hierarchical grid that is paginated at the database level.

For example:
  • Pull 50 categories from the database (set virtual item count to enable viewing of all pages).
  • Show an expand button if that category has a parent category.
  • If expand button is clicked, expand those 50 categories, repeating the same functionality in the above steps to allow categories to be expanded to the Nth level.

The only way I can accomplish this right now is to get a list of ALL categories in the database. This is not very efficient.

Is there any example displaying this?

5 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 28 Jan 2011, 02:16 PM
Hi Brad,

With self-referencing hierarchy you pass only one datasource to the mastertable and based on it the grid control resolves the child levels and the place of each item in them. Therefore, if I understand you correctly, your requirement for custom paging cannot be achieved in self-referencing hierarchy in RadGrid. I suggest you to consider using regular hierarchy, where you decide what to bind to each detail table.

Greetings,
Tsvetina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
PSCU Developers
Top achievements
Rank 1
answered on 28 Jan 2011, 03:11 PM
So, what you're trying to say is: the telerik radgrid cannot support pagination at the database level with self-referencing hierarchy's?

What happens if I have a table in the database that is self-referencing and there are 2 million rows? I would have to pull ALL 2 million rows and bind that to a grid?

If that is the case, is it possible to use the rad grid to dynamically create child tables for each parent record (when expanded, on demand)? Do you have an example of this?
0
PSCU Developers
Top achievements
Rank 1
answered on 01 Feb 2011, 06:13 PM
I am still having issues properly paginating a self referencing hierarchy at the database level.

Can you please provide an example that will perform well for the following:
  • A self referencing database table (Id, parentId) that contains 2 million rows.
  • A self referencing grid that will only take x records from the database at a time (page size, 50 for example) so if the user clicks page 2, then it will pull the next 50 records.
  • When expanding root level items, grab the next 50 records for the children (this also to be paginated at the database level) so if the user clicks page 2, it will query the next 50 child records from the database.
  • Perform in the same manner as the above for all levels of the hierarchy, since it is self referencing, this number could be infinite.

Currently, I do not see any examples of this in the demos. The demo just takes all records from a table, which is fine if you don't have much data. It also appears (according to the documentation) that the radgrid self referencing hierarchy lacks support for this. If that is the case, do you have an alternative method to do this with the radgrid?

Thanks for your help.

0
Tsvetina
Telerik team
answered on 02 Feb 2011, 10:39 AM
Hi Brad,

There is no way to build a self-referencing hierarchy without resolving each record to see whether it has a parent or not and at what level of the hierarchy it resides. Like I told you in my previous reply, your requirement is more likely to be achieved using a regular hierarchical grid with programmatic binding, where you can pass a filtered set of records in the DetailTableDataBind event for each detail table.

Hierarchical data-binding using DetailTableDataBind event
Programmatic Binding

All the best,
Tsvetina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
PSCU Developers
Top achievements
Rank 1
answered on 02 Feb 2011, 03:18 PM
Thank you very much for providing me with an example.
Tags
Grid
Asked by
PSCU Developers
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
PSCU Developers
Top achievements
Rank 1
Share this question
or