856
Views
14
Comments
infinite scrolling with limited records from Database
Question

I have created infinite scroll on TableRecords. Here I have used variable MaxCount = 20 in Preparation.

On each scroll MaxCount += 20.

And then, Used this var on Max. Records property of AdvanceSQL from which I'm fetching data. But SQL is returning all the records.

Ex: On load 20, On first scroll (20+20), third (40+20)...

But, I need data as per current pages, like only next 20 records each time, and then append those 20 records to the list and show that in the table bottom.

2024-02-27 12-57-22
Sam Rijkers

If I understood your question correctly, I'd say you want to fetch the data with an offset. Check below link for more information on that:

https://www.geeksforgeeks.org/sql-offset-fetch-clause/

2024-12-04 07-24-25
Amol

Correct Sam, But again you need to add those records to prev list variable, then Refresh Table.

But, If records goes to thousands it will take more time to load.


I need something, Which will append data directly to end of the table. 

2024-02-27 12-57-22
Sam Rijkers

Ah I see. I just found an infinite scroll component in the forge. Did not take a look at it yet, but maybe this could help you?

Otherwise I wouldn't know how to help you.

2024-12-04 07-24-25
Amol

Thanks for the help Sam, 

But here also they are fetching all the data in next scroll.

2024-12-04 07-24-25
Amol

Can anyone please give me some solution for this!

2020-09-17 01-03-04
Koushik Prathi

Hi Amol Tupe,

There is a component similar to your requirement.

Just go through the link https://www.outsystems.com/forge/component-overview/4781/demo-optimized-advance-sql-with-paging

Hope this will Help you.

Regards,

Koushik


2024-12-04 07-24-25
Amol

Koushik, I got solution to fetch limited records,

But, now I want to append those records to Table, without refreshing complete data. Just append new records at bottom.


Because, It is regenerating complete HTML structure each time.

2020-09-17 01-03-04
Koushik Prathi

Amol create a variable of the List data type.

On Preparation after fetching the data assign the data to the variable, and bind the variable to the table records widget.

OnNotify action of the List Navigation Widget re-execute the query and use the List Append All server action assign the data to the  List variable, refresh the table record.

Hope this will helps you.

Regards,

Koushik

2024-12-04 07-24-25
Amol

I don't want to refresh complete table records, There will be thousands of data in the table, If complete table refreshed, then it will take time to re-generate complete HTML.

So, I just want to append newly fetched data at the end of table. 

2014-10-21 20-15-17
Alberto Ferreira

Hello Amol 

I not totally sure if I understand what you want. Can o please give one example...


As I could understand the Koushik proposal can be a solution. You can add new rows to the list variable and delete (before or after) the first records (in the list), keeping the list small... if it is what you want..!


Regards

2024-12-04 07-24-25
Amol

Alberto Ferreira wrote:

Hello Amol 

I not totally sure if I understand what you want. Can o please give one example...


As I could understand the Koushik proposal can be a solution. You can add new rows to the list variable and delete (before or after) the first records (in the list), keeping the list small... if it is what you want..!


Regards


As per above solution,

If records goes to thousands, then If we refresh complete table, It will take some time to generate HTML for table with thousands of records.
Instead of that, I want to generate HTML only for 20 records and append those records to the end of existing HTML table. 

2020-09-17 01-03-04
Koushik Prathi

Amol, After appending the values to the list, in web you have to perform ajax refresh on the table record widget to render the updated list.If you are not performing ajax refresh then the updated list of values are not rendered on the screen.

 

2024-12-04 07-24-25
Amol

All is good, I'm refreshing it.


But if 1000 records are loaded after many scroll, then DOM will take time to render 1000 records, 

In next call, It will load more 20 records, Then it will again refresh for 1020 records.
I don't want that, I want to add only those new 20 records, Don't want to touch old records. 

2024-12-02 12-15-17
Aravind EONE

If it is the requirement, Please try with reactive web. table refresh is not required there. and the data append is real time as like you asked above.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.