如何从ListView分页中的api获取json数据

时间:2019-03-29 09:32:42

标签: xamarin.forms syncfusion

我想通过分页从ListView中的Web API获取数据。到目前为止,我在代码中看不到任何问题,但是在Handle_OnDemandLoading中获取空值

 private FeaturedItemList products = new FeaturedItemList();  
        protected async void FeaturedList()
        {

   var httpClient = new HttpClient();


                        var json = await httpClient.GetStringAsync("http://orangepotato.rjcpacking.com/index.php?route=api/login/getFeaturedProducts");


                        products = JsonConvert.DeserializeObject<FeaturedItemList>(json);

                        dataPager.Source = products.products;



        }  
void  Handle_OnDemandLoading(object sender, Syncfusion.SfDataGrid.XForms.DataPager.OnDemandLoadingEventArgs e)
        {
            var source= products.products.Skip(e.StartIndex).Take(e.PageSize);
            FeaturedlistView.ItemsSource = source.AsEnumerable();// here is i am getting null values but i am getting values in datapager.source
        }

0 个答案:

没有答案