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

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

6 Answers 90 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Greg
Top achievements
Rank 1
Greg asked on 07 Jul 2014, 07:58 PM
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).

6 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 08 Jul 2014, 02:30 PM
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.
 
0
Greg
Top achievements
Rank 1
answered on 08 Jul 2014, 05:43 PM
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?
0
Dimitrina
Telerik team
answered on 10 Jul 2014, 08:31 AM
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.
 
0
Greg
Top achievements
Rank 1
answered on 10 Jul 2014, 02:06 PM
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.
0
Greg
Top achievements
Rank 1
answered on 10 Jul 2014, 04:13 PM
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.
0
Yoan
Telerik team
answered on 14 Jul 2014, 03:40 PM
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.
 
Tags
GridView
Asked by
Greg
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Greg
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or