14
Views
2
Comments
Solved
Mobile: the OnScrollEnding action: refreshed list position
Application Type
Mobile

using the standard OnScrollEnding action from the scafhold patern in Mobile, I have set the following:

MaxRecords = 50

IncrementRecords = 20

infinite-scroll-threshold = 10 (in attributes of the list pattern)

So, I can scroll to the end of the list, when the OnScrollEnding action is triggered.

This refresshes the list and loads the number of records equal to the new value of MaxRecords. But the list's position shown is 7 records from the top. I want it to show the last 20 records, with the top one visible being the 20th record from the bottom. How can I implement this?


Solution

Hi Hubert. This is possible by binding a local list variable to the list widget, and then assigning the list items you wish to display using a loop. Keep track of the new first record after each scroll ending using a local variable. 

I have attached a very simple (and untested) example. 

I do question the user experience of this requirement though? Remember that the user will not be able to see the upper part of the list each time when the list refreshed of scroll ending. 

Do you not think Pagination would be better suited? 

ForumTestMobileApp.oml

Rank: #5476

Hi Nicholas. Thank you very much for your effort in helping me.

I have implemented your method and it does exactly what I indended! 

Everytime I reach the end of the list, the OnScrollEnding action adds 20 more records to the list until there are no more records in the underlying local table. The user can scroll back to the top of the list and see all the previously displayed records.

When the data is refreshed, I clear the local list variable, set 'FirstRowNumber' to 0  and add the initial 50 records again.

There may be a small performance penalty, but I think we can live with it, especially since recent phone models have plenty of CPU power to handle this.

I have to change a few other things such as the search filter action, but I think I can find solutions for them. Thanks again.

Regards,

Hubert.