You can do the following:
- Create a helper entity (pageHelper) which holds an attribute boolean calles showAllRecords
- Open the page you are referring to from a microflow, create an object of the helper entity where showAllRecords is false and pass this to the page.
- On the page set two datagrids/ listviews. The first one has the amount of rows set to 20, the second one you set the amount of rows to 99999.
- Set the visibility of the listviews based on $pageHelper/showAllRecords
- Create a button for the user to set showAllRecords to true/false
Basically, You can achieve the same using multiple views.
Have a booleans like IsDefaultView .
When IsDefaultView is true , Display the default records with the button which shows the count of remaining records.
On click of button , Update IsDefaultView to false which displays the another listview with all records
I hope this helps you