Master-Detail with auto-generated Detail rows, refresh problem

7 posts, 0 answers
  1. Greg
    Greg avatar
    35 posts
    Member since:
    Sep 2013

    Posted 07 Jul 2014 Link to this post

    I have a master detail screen using gridviews.

    When a new master row is saved, the server creates detail rows, but the detail gridview does not display/retrieve these new rows until a different master row is selected and then the new master row is again selected.

    How can I get the detail gridview to retrieve these new rows as soon as the save is done?

    Putting detailDataSource.Refresh() after the masterDataSource.SubmitChanges() does not work.

    Thanks. (This is in a MVVM system btw).
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 08 Jul 2014 Link to this post

    Hello,

    You will have to recreate the row in order to have the row details added to it. Would you try invoking a RadGridView.Rebind()?

    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.
     
  3. Greg
    Greg avatar
    35 posts
    Member since:
    Sep 2013

    Posted 08 Jul 2014 in reply to Dimitrina Link to this post

    I am not sure how to force a Rebind in my viewmodel event:


    private void RowEditEnded(GridViewRowEditEndedEventArgs args)
    {
      if (!args.ChangesActuallyMade())
      {
        return;
      }

      // Loans is the QueryableDataServiceCollectionView
      Loans.SubmitChanges();
    }

    How do I reference the RadGridView that triggered this event so I can call Rebind after the SubmitChanges?
  4. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 10 Jul 2014 Link to this post

    Hello,

    You need a reference of RadGridView to invoke such a reset invoking its Rebind() method.
    Another way would be to raise a CollectionChanged notification for the row you create detail rows for. Is it possible for you to remove the entire row and then insert/add it again after you updated it accordingly?

    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.
     
  5. Greg
    Greg avatar
    35 posts
    Member since:
    Sep 2013

    Posted 10 Jul 2014 in reply to Dimitrina Link to this post

    I am new to MVVM and Telerik, so please excuse these basic questions:

    - How do you get a reference to an object in the view from with the viewmodel? (My viewmodel does not have a direct reference to the view).

    - How would I raise the CollectionChanged notification as you suggest?

    Thanks.
  6. Greg
    Greg avatar
    35 posts
    Member since:
    Sep 2013

    Posted 10 Jul 2014 Link to this post

    I resolved this problem by resetting the FilterDescriptor used by the child gridviews in the parent gridview's QueryableDataServiceCollectionView's OnSubmittedChanges event.

    Even if the resulting filter matches the pre-existing filter, it triggers the refresh I needed.
  7. Yoan
    Admin
    Yoan avatar
    1214 posts

    Posted 14 Jul 2014 Link to this post

    Hi,

    Thank you for the update. I am glad to hear you have resolved the issue.

    Regards,
    Yoan
    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