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

RadGridView and MVVM

4 Answers 179 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Koen
Top achievements
Rank 1
Koen asked on 19 Sep 2012, 08:29 AM
Here's my situation:

  1. an MVVM pattern is used on the client
  2. the View has a readonly RadGridView with sorting and paging through the RadDataPager
  3. the ViewModel has a Repository, wrapping an EntityFramework ObjectContext


What is the best way to integrate the RadGridView/RadDataPager  with this Repository?

I have been looking at QueryableCollectionView, but found myself wondering:
- how do the sort and filter parameters get translated into the object context query?
- how does the page information gets passed into an object context query?

Do I need to take care of all these things myself?
Or is there a better integration, so that the Telerik components involved know
how to deal with an IQueryable<T> and do all the paging, sorting, filtering?

Thanks for your time,
Koen

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 19 Sep 2012, 08:37 AM
Hi Koen,

QueryableCollectionView will use your IQueryable and will create everything need for paging, sorting, filtering, grouping, etc. automatically. You do not have to do anything by yourself. 

All the best,
Vlad
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
Koen
Top achievements
Rank 1
answered on 19 Sep 2012, 09:08 AM
Thanks, that looks good.

Is there any way to alter the queryable, once the QueryableCollectionView is created?

Suppose I have an external filter I want to apply, afterwards?
Or do I have to re-create the QueryableCollectionView with the new IQueryable.


Thanks?
Koen
0
Koen
Top achievements
Rank 1
answered on 19 Sep 2012, 11:23 AM
Two more questions:

  1. Is it possible to have the "QueryableCollectionView" evaluate the IQueryable asynchronously?
    Now it blocks the UI Thread whenever the database call takes some time. 
  2. Is there an event available when the "QueryableCollectionView" is about to enumerate an IQueryable / is done enumerating?
    This would make it easier to open / close on ObjectContext at appropriate times



Thanks again,
Koen
  
0
Vlad
Telerik team
answered on 20 Sep 2012, 06:00 AM
Hi,

 You can turn on the grid asynchronous mode to achieve your goal (DataLoadMode="Asynchronous"). I'm not sure however I understand your second question. You do not need to open/close any context since this will done automatically. 

All the best,
Vlad
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

Tags
GridView
Asked by
Koen
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Koen
Top achievements
Rank 1
Share this question
or