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

Paging is not enabled when DomainContext has changes

11 Answers 140 Views
DomainDataSource
This is a migrated thread and some comments may be shown as answers.
Aasiya
Top achievements
Rank 1
Aasiya asked on 16 Jan 2012, 11:50 AM
Hi,
We are developing an application with Silverlight 4 & Prsim 4.

We Have two views  and  we are using single DomainContext for both views.

1. JobListView  - displays data in RadGridView. Paging is implemented  with QueryableCollectionView + RadDataPager.
2. JobView - in this view we add new JobEntities or modify existing job entities.

First time when we open JobListView paging is working fine. But when we open JobView and add a new entity or change exisiting entity and navigate to the JobListView, Paging is not working, i.e data pager control is disabled. Only when we submit/ reject the changes in JobView only paging is enabled. I've observed that  when 'DataContext.HasChanges=true" , paging is getting disabled.

We need Paging enabled all the time in JobListView. Is there any way to enable the paging while the DataContext's HasChanges is set to true?

Following is our sample code :
JobListviewModel :

private

QueryableDomainServiceCollectionView<Job> allJobsView; 

public
JobListViewModel()

{    
      jobRequestService = new JobRequestService();

     this.allJobsView = jobRequestService.GetAllJobs();

     this.allJobsView.PageSize = 20;

     this.allJobsView.AutoLoad = true;      

    
        //Sorting  

    this.RequestNumberSortDescriptor = new SortDescriptor() { Member = "RequestID"
                                            SortDirection=
ListSortDirection.Descending };

         this.allJobsView.SortDescriptors.Insert(0, this.RequestNumberSortDescriptor);

 }

public  IEnumerable AllJobsView  

get { return this.allJobsView;}  }

 
JobListview.xaml
------------------

 <telerik:RadGridView x:Name="RadGridViewAllJobs" ItemsSource="{Binding AllJobsView}" AutoGenerateColumns="False">

      <telerik:RadGridView.Columns>
                    <!--Columns-->

         </telerik:RadGridView.Columns>

 </telerik:RadGridView>

 <telerik:RadDataPager x:Name="radDataPager" Source="{Binding AllJobsView}"

         DisplayMode="All" IsTotalItemCountFixed="False" />

 

11 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 16 Jan 2012, 12:25 PM
Hello,

This behavior is by design. When there are pending changes, you have to either submit or reject them before you can be able to load data again.

All the best,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Aasiya
Top achievements
Rank 1
answered on 16 Jan 2012, 12:36 PM
Hi, Thank you for the immediate response.

Once the JobListView loads frist time, and when we navigate to it again from JobView,  Prism does not referesh JobListView , i mean data does not get reloaded.  

Is there any way to make the paging enabled while DataContext has changes ? i mean without submitting or rejecting can't we enable the paging? Please suggest...

0
Accepted
Rossen Hristov
Telerik team
answered on 16 Jan 2012, 12:48 PM
Hello,

This behavior is by design for a reason, so there is no way to do what you want.

Greetings,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Enrico
Top achievements
Rank 1
answered on 20 Feb 2013, 08:31 AM
Hi,

I run into the same issue. Even setting
Telerik.Windows.Controls.DomainServices.LoadingDataEventArgs
LoadBehavior to RefreshCurrent does not work.

What is the reason to ignore the behavior?

What is your suggested work-around for a shared context for loading and editing data?
0
Rossen Hristov
Telerik team
answered on 20 Feb 2013, 08:44 AM
Hi,

What do you mean by RefreshCurrent does not work? This behavior is part of the WCF RIA Services stack, not Telerik. Our control is simply built on top of the WCF RIA Services stack and simply uses it -- it does not do the actual transport between the client and the server. This is done by WCF RIA Services.

You can read more about this behavior here. If you think that this WCF RIA Services property does not work correctly, you can file a bug report with Microsoft Connect.

Kind regards,
Rossen Hristov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Enrico
Top achievements
Rank 1
answered on 20 Feb 2013, 09:02 AM
I mean that i set LoadBehavior by using the LoadingData callback of the DataSource, but the control just avoids loading when there are changes in the context.

Until now you did not explain the design decision you mentioned.
0
Rossen Hristov
Telerik team
answered on 20 Feb 2013, 09:18 AM
Hi,

RadDomainDataSource will auto-load when its AutoLoad property is set to true and one of the following changes:

- FilterDescriptors
- SortDescriptors
- GroupDescriptors
- PageIndex
- PageSize

If AutoLoad is false, then it is your responsibility to call the Load() method when you need to refresh from the server.

In fact that is all that this control does. All the rest is done by the WCF RIA Services DomainContext. The control is simply a very very thin wrapper over it and simply appends Where, OrderBy, Skip and Take clauses to its query based on the Descriptors mentioned above.

RadDomainDataSource does not listen for someone making external changes to its DomainContext from the outside. If one want to manully do everything with a DomainContext, then there is no need to use RadDomainDataSource. One can simply instantiate a DomainContext and control everything by hand.

This blog post explains what RadDomainDataSource actually is.

If you think that there is some kind of bug with the control, please prepare and send us a fully runnable dummy project that clearly demonstrates the bug and state what the expected behavior should be. You can use one of the generic DB's such as Northwind or Adventure Works.

I hope this helps.

Regards,
Rossen Hristov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Enrico
Top achievements
Rank 1
answered on 20 Feb 2013, 09:37 AM
The manual call to Load() is what i did.

I call the Load() method on the DataSource. Via its view the datasource calls QueryableDomainServerCollectionViewBase.Load(). This one checks the CanLoad-Property, which returns false because the DomainContext has changes.
Thats why there is no chance for me to reject the changes by using the LoadBehavior.

What was the reason to stop loading when there are remaining changes in the context?
0
Rossen Hristov
Telerik team
answered on 20 Feb 2013, 10:05 AM
Hello,

Exactly. This is the design.

When there are changes, i.e. the DomainContext is dirty, you have to explicitly call either RadDomainDataSource.SubmitChanges() or RadDomainDataSource.RejectChanges() in order to save or cancel the changes. Only after one of those methods is called, loading will be enabled again. And paging also (which is in fact loading).

I hope this helps.

Regards,
Rossen Hristov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Tuan Hoang
Top achievements
Rank 1
answered on 27 Apr 2014, 04:40 PM
I use QueryableDomainServiceCollectionView for lookup. When i edit one text on other columns,  QueryableDomainServiceCollectionView of my control on lookup columns can not run load because there are changes. 

Is there other solution?

0
Dimitrina
Telerik team
answered on 29 Apr 2014, 10:58 AM
Hi,

I am not sure I understand your questions properly. May I ask you to provide more details on what is the current behavior you have and what is the desired result?

As this forum thread is on paging and your question seems to be different, may I ask you to open a new thread on the proper topic? You can provide the additional details there.

Regards,
Didie
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
DomainDataSource
Asked by
Aasiya
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Aasiya
Top achievements
Rank 1
Enrico
Top achievements
Rank 1
Tuan Hoang
Top achievements
Rank 1
Dimitrina
Telerik team
Share this question
or