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
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 >>
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...
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 >>
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?
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.
Until now you did not explain the design decision you mentioned.
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.
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?
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.
Is there other solution?
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