In Listview per page thrice number of actual number of fetched data showing by duplicating thrice.

Hello Syncfusion,

I am Sourav. I am working on a project where I implemented SfListview to fetch my data using api. 
When normally I am fetching data using xamarin's traditional way (without LOAD MORE) there is no duplication or repeat of data items in listview.

But when I am using SfListview, the duplication of a list happning three times in that perticular listview's single page.

Explanation of Problem: 
You can see in my project there is 25 items me showing per page.

Case 1: When I am using xamarin's traditional way there is no duplication of data item in listview;s single page and also showing 25 items smoothly.

Case 2: But when I am using SfListview per page showing 75 items (25 items list duplicating 3 times) in second page its showing 50 items ( 25 items list duplicating 2 times) and like that in rest of possible pages.

I did posted the same problem some days back.Got feedback from you people.Tried hard to find out the solution but unable to figure out what should be the solution of this problem.
Guys, I really need your support.Only you can make me stay at my current job.I am using Syncfusion for couple of months some some attachment is there,Telerik offered my boss to solve the problem.But boss is staying in Syncfusion because of my words.Nothing to say more.

Sending both project, WithLoadMore and WithoutLoadMore. Check the code and provide me solution.
Please help me out.

Always feel smooth using your product hope in this case also there will be no exception.
Thanks in advance.

Special Note. 1.Extract the .rar file. there will be two project.One without loadmore and one with loadmore.
                       2.The project doesn't has the packages.first build both the files will be there. 
                  
                       Thanks for attention.

Regards,
Sourav 

Attachment: BothProject_500f40d2.rar

7 Replies

SR Sivakumar R Syncfusion Team August 3, 2018 08:26 PM UTC

Hi Sourav 
 
I have checked your application and your getting duplicate items because you have set IsBusy as false before fetching the date from services. Now  I have added await to set IsBusy as false, to avoid multiple calls. Can you make this change and confirm whether the issue is fixed? 
 
private async void LoadMoreItems(object obj) 
{ 
    var listview = obj as Syncfusion.ListView.XForms.SfListView; 
    IsBusy = true; 
    int index = (int)(woList.Count / 25); 
    await FetchData(index, 25); 
    IsBusy = false; 
} 
 
public async Task FetchData(int index, int count) 
{                                                
    var woDetails = new Access(); 
    List<WOList> lst = await woDetails.GetData(index, count, Mode, SelectedStatus); 
    foreach (WOList w in lst) 
    { 
        woList.Add(w); 
    } 
} 
 
I was able to compile and run the application. But getting below exception.  
Unhandled Exception: 
System.Net.Http.HttpRequestException: An error occurred while sending the request occurred 
 
If the problem still persist, Please create incident where we will arrange online meeting to check this problem in your machine and resolve as early as possible. 
 
Thanks, 
Sivakumar 



SO Sourav August 4, 2018 08:34 AM UTC

Hey..!!
I applied the solution what you provided.But still same problem is there.


SR Sivakumar R Syncfusion Team August 4, 2018 02:28 PM UTC

Hi Sourav, 
 
ListView won’t add duplicate items. It will just display whatever items added in woList collection. Can you check in FetchData method and make sure duplicate items are not returned from service. In meantime if the problem still persist, Can you please create incident with your convenient time for meeting on 6th Agust, 2018 where we will arrange online meeting to check this problem in your machine and resolve as early as possible. Due to limited access, I could not crate incident on behalf of you. So, I request you to create incident from your account for sharing meeting details. 
 
Thanks, 
Sivakumar 



SO Sourav August 6, 2018 05:41 AM UTC

I checked the data fetching procedure.And the service is not returning the duplicate list.
I found that the service is being called multiple times automatically only to  load 25 items of single page.
It's hitting the RestClient.cs and flow is returning after executing "response = await httpClient.PostAsync(url, content);" .
Not executing the next rest of  line which is:
            var result = await response.Content.ReadAsStringAsync();
            T responseResult = JsonConvert.DeserializeObject(result);
            return responseResult;
And again checking "Canloadmore" and executing "LoadMoreItems" these two part of Command of ViewModel.

And this whole process is repeating 3 or 4 times and after that 3 or 4 times it returning duplicated value, a list 3 or 4 times.


VR Vigneshkumar Ramasamy Syncfusion Team August 6, 2018 11:50 AM UTC

Hi Sourav,  
  
Sorry for the inconvenience.  
  
We have confirmed that reported issue is a defect and logged a defect report for this. The fix will be included in our upcoming 2018 Volume 2 SP2 release which is scheduled to be rolled out by the end of August month. We will appreciate your patience until then.   
  
You can use below workaround in your sample to avoid addition of items repeatedly while using load more.  
  
  
private async void LoadMoreItems(object obj)  
{  
    var listview = obj as Syncfusion.ListView.XForms.SfListView;  
    if (IsBusy)  
        return;  
    IsBusy = true;  
    int index = (int)(woList.Count / 25);  
    await FetchData(index, 25);  
    IsBusy = false;  
}  
  
  
Please let us know if you require any further assistance.  
  
  
Regards,  
Vigneshkumar R 



SO Sourav August 8, 2018 06:46 AM UTC

Hi Vigneshkumar,

Thank you so much for providing that fix.It worked and all values are returning fine.Thank you again.


JN Jayaleshwari N Syncfusion Team August 9, 2018 12:32 PM UTC

Hi Sourav,   
  
Thanks for the update.  We are happy that given workaround helped you in achieving your requirement. We will include the fix for the reported issue in SP2 as promised.   
  
Regards,   
Jayaleshwari N.   


Loader.
Up arrow icon