I have a grid with many records (over 1M records) in my DB. I want to only request the data that will be displayed on the current grid from my DB. What I do is pass my current page and pageSize to my java code in order to determine how many records I will skip in my DB.
Ex. If I navigate to page 5 with a pageSize of 20, I will skip the first 80 records and receive the next 20.
This is working so far, but my issue is that when I receive those 20 records of data and place it in my dataSource; page 5 will show up empty since the data will only be displayed on page 1.
A work-around I found is to fill my dataSource data with empty JSON objects {}. This works, but if I were to input 100,000 empty JSON objects, the program will crash.
What can I do to display my data on the specific page I'm on, and basically ignore all the other pages when I'm not visiting them?