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

GridView and large complex data

3 Answers 255 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Marcin
Top achievements
Rank 1
Veteran
Marcin asked on 14 Jun 2013, 12:23 PM
Hello,
I have quite complex object with joins and sub-queries to display on grid. Currently I'm getting only 1000 records from database to get better performance. I would really like to have benefits from grid filtering, sorting, server side virtualization, and paging to enable in rare cases uses to go through all data. However I didn't find any way or information how to to do that with complex select data. This data is currently collected 100% using Entity Framework. I've looked to use yours entity framework data source but it only allows simple usage - native entities not complex custom joins.

Could you advice me how to achieve that?

3 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 18 Jun 2013, 10:28 AM
Hello,

RadGridView uses LINQ (i.e. it plays nicely with any IQueryable assigned as its ItemsSource) for filtering (Where), sorting (OrderBy) and grouping(GroupBy). Naturally, it can only filter, sort and group on the properties (i.e. read Columns) of the entity that is returned by your ObjectQuery<T>.

So if you bind RadGridView to your ObjectContext.Customers for example, it will auto-generated columns for the Customer class and you will be able to perform the data operations on them.

I am not sure how a "quite complex object with joins and sub-queries" fits in this picture and what exactly are you trying to achieve. Can you do what you need by using pure LINQ against your complex objects?

Regards,
Rossen Hristov
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Marcin
Top achievements
Rank 1
Veteran
answered on 19 Jun 2013, 06:40 AM
Hello,
By complex I mean views with special joins (not includes), based on 2 or more values and by sub-queries I mean join with grouped value from other table (to display only one record as relation not all subsequent records).

The result is IQueryable, so if it would be possibile to pass sorting/filtering/paging as final part of my linq it would solve my problems with performance and virtualization.

Kind Regards
Marcin

0
Accepted
Rossen Hristov
Telerik team
answered on 19 Jun 2013, 07:27 AM
Hello,

If your source is IQueryable (and IEnumerable I hope), bind RadGridView.ItemsSource to it and the grid will directly apply filtering, sorting and grouping to this IQueryable. Let me give a dummy example:

var result = myQueryable.Where(customer => customer.Age > 5).OrderBy(customer => customer.Name);

The grid's data engine builds, compiles and executes similar statements at runtime when you filter, sort and group through the UI. The grid does not care what this IQueryable is and what happens with the clauses it appends to it -- that's the IQueryable's job.

I hope this helps.

Regards,
Rossen Hristov
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Marcin
Top achievements
Rank 1
Veteran
Answers by
Rossen Hristov
Telerik team
Marcin
Top achievements
Rank 1
Veteran
Share this question
or