Unplanned
Last Updated: 20 Apr 2023 10:27 by ADMIN
Peter
Created on: 20 Apr 2023 10:20
Category: DataGrid
Type: Bug Report
0
DataGrid: Loading indicator is visible when the data is loaded through LoadOnDemandCommand and Execute method is not async
LoadOnDemandContext.HideLoadOnDemandLoadingIndicator() needs to be in an async method, otherwise it will keep the indicator visible forever
1 comment
ADMIN
Didi
Posted on: 20 Apr 2023 10:27

Solution:

make the Execute method async as in the demo: https://docs.telerik.com/devtools/xamarin/controls/datagrid/load-on-demand#using-loadmoredata-command , or use a dispatcher: 

public override void Execute(object parameter)
{
    if (parameter == null)
    {
        return;
    }
    var context = (LoadOnDemandContext)parameter;
    context.ShowLoadOnDemandLoadingIndicator();

    var viewModel = this.Owner.BindingContext as LoadOnDemandViewModel;
    if (viewModel != null)
    {
        for (int i = 0; i < 10; i++)
        {
            viewModel.Items.Add(new Person { Name = "Person " + i, Age = i + 18, Address = "NEW Address" + i, Checked = false });
        }
    }
    Device.BeginInvokeOnMainThread(() => {
        context.HideLoadOnDemandLoadingIndicator();
    });
}

 

Regards,
Didi
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.