Paging is not enabled when DomainContext has changes

12 posts, 1 answers
  1. Aasiya
    Aasiya avatar
    5 posts
    Member since:
    Jan 2012

    Posted 16 Jan 2012 Link to this post

    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" />

     

  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 16 Jan 2012 Link to this post

    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 >>

  3. DevCraft banner
  4. Aasiya
    Aasiya avatar
    5 posts
    Member since:
    Jan 2012

    Posted 16 Jan 2012 Link to this post

    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...

  5. Answer
    Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 16 Jan 2012 Link to this post

    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 >>

  6. Enrico
    Enrico avatar
    6 posts
    Member since:
    Dec 2012

    Posted 20 Feb 2013 Link to this post

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

    Posted 20 Feb 2013 Link to this post

    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.

  8. Enrico
    Enrico avatar
    6 posts
    Member since:
    Dec 2012

    Posted 20 Feb 2013 Link to this post

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

    Posted 20 Feb 2013 Link to this post

    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.

  10. Enrico
    Enrico avatar
    6 posts
    Member since:
    Dec 2012

    Posted 20 Feb 2013 Link to this post

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

    Posted 20 Feb 2013 Link to this post

    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.

  12. Tuan Hoang
    Tuan Hoang avatar
    5 posts
    Member since:
    Jun 2010

    Posted 27 Apr 2014 in reply to Rossen Hristov Link to this post

    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?

  13. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 29 Apr 2014 Link to this post

    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.
     
Back to Top
DevCraft banner