Completed
Last Updated: 03 Jun 2019 14:41 by ADMIN
Release 2019.2.603.360 (R2 2019 minor release)
RR
Created on: 03 May 2019 11:37
Category: ListView
Type: Bug Report
0
ListView: [Android] Items are not loaded after second LoadOnDemandItemTemplate is tapped.

this is list view with loadondemand active

<telerikDataControls:RadListView Grid.Row="1"
       x:Name="RecentEvents"
      ItemsSource="{Binding PreviewEvents, Mode=TwoWay}"
       VerticalOptions="FillAndExpand"
        ItemTapped="RecentEvents_ItemTapped"                                    
       SelectionMode="Single"
        IsLoadOnDemandEnabled="True"
        LoadOnDemandMode="Manual"
        LoadOnDemand="RecentEvents_LoadOnDemand"
        IsPullToRefreshEnabled="False">
                    <telerikDataControls:RadListView.ItemTemplate>
                        <DataTemplate>
                            <telerikListView:ListViewTemplateCell>
                                <telerikListView:ListViewTemplateCell.View>
                                    <templates:RecentEventTemplate/>
                                </telerikListView:ListViewTemplateCell.View>
                            </telerikListView:ListViewTemplateCell>
                        </DataTemplate>
                    </telerikDataControls:RadListView.ItemTemplate>
                    <telerikDataControls:RadListView.LoadOnDemandItemTemplate>
                        <DataTemplate>
                            <Grid WidthRequest="{Binding LoadMoreWidth}" HeightRequest="40" BackgroundColor="Gray"
                                  HorizontalOptions="CenterAndExpand"
                                  VerticalOptions="CenterAndExpand"
                                  IsVisible="{Binding IsLoadMoreVisible,Mode=TwoWay}">
                                <Label HorizontalOptions="CenterAndExpand" 
                                   Text="{i18n:Translate CALENDAR_LOAD_MORE_EVENTS}"
                                   HorizontalTextAlignment="Center"  FontSize="Small" VerticalTextAlignment="Center"/>
                            </Grid>
                        </DataTemplate>
                    </telerikDataControls:RadListView.LoadOnDemandItemTemplate>
                </telerikDataControls:RadListView>

private async void RecentEvents_LoadOnDemand(object sender, EventArgs e)
        {
            //RecentEvents.EndRefresh(false);
            var vm = (HomePageViewModel)ViewModel;
            await vm.GetRecentEvents(true);
         
        }

Issue is :  After first time "Load More" button get disabled. (Doesnt seem to click) . Soon after loading it works.  Once it is clicked it loads the new items as well. After that the "Load More" but is not clickable. Atleast click doesnt seem to trigger the RecentEvents_LoadOnDemand event.

Any issues which could be the reason for this? 

Thank you in advance

1 comment
ADMIN
Didi
Posted on: 07 May 2019 11:25
Hi Roshan,

Thank you for the provided code.

I have tested the described scenario and I reproduced the issue with the LoadOnDemandItemTemplate on Android. It seems that the LoadOnDemandItemTemplate is not working properly on Android when LoadOnDemandMode is set to Manual.

I have converted this Forum thread into a public Bug Report Feedback Item. Please find your Telerik points updated as a small sing of gratitude for your involvement. 

Workaround:

You could use the following approaches as a workaround:

- use the default LoadOnDemandItemTemplate

- use the RadListView FooterTemplate. Inside it add a Button and on its Clicked event execute the RecentEvents_LoadOnDemand. For example:

<dataControls:RadListView x:Name="listView"
                  IsPullToRefreshEnabled="False"
                  IsLoadOnDemandEnabled="True"
                  SelectionMode="Single"
                  LoadOnDemandMode="Manual"
                  LoadOnDemand="RecentEvents_LoadOnDemand"
                  ItemsSource="{Binding Source}">
    <dataControls:RadListView.ItemTemplate>
        <DataTemplate>
            <listView:ListViewTemplateCell>
                <listView:ListViewTemplateCell.View>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Label Text="{Binding Title}" Grid.Row="0" FontSize="Large" TextColor="Black"></Label>
                        <Label Text="{Binding Author}" Grid.Row="1" FontSize="Medium" TextColor="Blue"></Label>
                    </Grid>
                </listView:ListViewTemplateCell.View>
            </listView:ListViewTemplateCell>
        </DataTemplate>
    </dataControls:RadListView.ItemTemplate>
    <dataControls:RadListView.FooterTemplate>
        <DataTemplate>
                <Button Text="Load On Demand" Clicked="RecentEvents_LoadOnDemand" />
        </DataTemplate>
    </dataControls:RadListView.FooterTemplate>
    <dataControls:RadListView.LoadOnDemandItemTemplate>
        <DataTemplate>
            <Grid>
            </Grid>
        </DataTemplate>
    </dataControls:RadListView.LoadOnDemandItemTemplate>
</dataControls:RadListView>

For more details please check the attached sample.

I hope I was helpful.

Regards,
Didi
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Attached Files: