19
Views
4
Comments
Solved
Lazy load / Infinite scroll
Question

Hi All,



I want to implement lazy loading into my mobile application,

I am fetching data through a server call which returns a list of records from aggregate.

I am using on scroll ending, how can i fetch the number of records(e.g. 20), each time i scroll the list int he incremental format.

Is there any query?



Thanks,

DM

Rank: #483
Solution

Hi Dhiraj,

Use a list variable to bind to the widget instead of using the SQL return list directly.

Then, you can use 

OFFSET @Skip ROWS
FETCH NEXT @Take ROWS ONLY

at the end of your SQL query, where @Skip is the number of records currently in your list variable and @Take is the number of new records you want to fetch.

So in the on lazy load action you will call the SQL, then append the returned records to the list variable.

Rank: #90

Hi Dheeraj,

You need to set max record 20 , when you scrolled it will populate 20 records.

see below image


Regards

Rahul Sahu

Rank: #483
Solution

Hi Dhiraj,

Use a list variable to bind to the widget instead of using the SQL return list directly.

Then, you can use 

OFFSET @Skip ROWS
FETCH NEXT @Take ROWS ONLY

at the end of your SQL query, where @Skip is the number of records currently in your list variable and @Take is the number of new records you want to fetch.

So in the on lazy load action you will call the SQL, then append the returned records to the list variable.