GridView and large complex data

4 posts, 1 answers
  1. Marcin
    Marcin avatar
    186 posts
    Member since:
    Jan 2011

    Posted 14 Jun 2013 Link to this post

    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?
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 18 Jun 2013 Link to this post

    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.

  3. Marcin
    Marcin avatar
    186 posts
    Member since:
    Jan 2011

    Posted 19 Jun 2013 Link to this post

    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

  4. Answer
    Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 19 Jun 2013 Link to this post

    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.

Back to Top