Hi Jasper,
We have analyzed your query. In your query, the LoadDynamicItems is invoked only after await is completed. So you have to call the PagedSource.Refresh () method after invoking the LoadDynamicItems method like the below code example,
Code Example:
{ await Task.Delay(1); sfDataPager.LoadDynamicItems(args.StartIndex, source.Skip(args.StartIndex).Take(args.PageSize)); sfDataPager.PagedSource.Refresh(); } |
We already have a kb to load the pages in OnDemand using async and await and the kb kink as below,
Kb Link:
https://www.syncfusion.com/kb/6133/how-to-load-pages-in-ondemand-using-async-await
Regards,
Jai Ganesh S
Hi Jasper,
We are adding the ItemsSource as asynchronously in detailsviewdatagrid as like in the following kb https://www.syncfusion.com/kb/2394/how-to-load-detailsview-itemssource-asynchronously) and the details view items are loaded as expected. Could you please modify the below sample to reproduce the reported issue. This would be more helpful for us to analyze further.
Sample:
http://www.syncfusion.com/downloads/support/directtrac/153477/ze/UWP2138393894-618551728
Regards,
Jai Ganesh S
Hi
Jasper,
We
analyzed your query. In that KB Sample, We have removed the Sleep method
and used Task.Delay. It is not possible to provide complete list to SfDataGrid
asynchronously, But you can add items to SfDataGrid details view asynchronously
without blocking current thread for getting items from service.
Code
Example:
private void
SfGrid_DetailsViewExpanding(object sender, Syncfusion.UI.Xaml.Grid.GridDetailsViewExpandingEventArgs e) { e.DetailsViewItemsSource.Clear(); var list = new ObservableCollection<dynamic>(); e.DetailsViewItemsSource.Add("Persons", list); var
underlyingList = GetItems(list); } private async Task<ObservableCollection<dynamic>> GetItems(ObservableCollection<dynamic> dynamicList) { await Task.Delay(2000);
dynamicList.Add(CreateDynamicObj("David", 1001, "Asst.Manager", 118));
dynamicList.Add(CreateDynamicObj("Alex", 1002, "Senior
Developer", 123));
dynamicList.Add(CreateDynamicObj("Christopher", 1003, "Senior
Developer", 121));
dynamicList.Add(CreateDynamicObj("Mary", 1004, "Accountant", 120));
dynamicList.Add(CreateDynamicObj("Angeline", 1005, "Asst.Manager", 105));
dynamicList.Add(CreateDynamicObj("Andrew", 1006, "Manager", 103));
dynamicList.Add(CreateDynamicObj("Michael", 1007, "Senior Developer", 124)); return dynamicList;
} |
Please
refer the modified sample from the below location,
Regarding query: . I would need a way to update/refresh
the detail grid when GetItems() actually
returns, like I can refresh the data pager once I have received the data.
In
the GetItems method, you can add items once you receive data from service.
Regards,
Jayapradha