Download the asset and see the details in this sequence - i use aggregate User for the sample - Cookbook:
1. Create data action GetuserList:
# Check the filter, and dynamic sort in here, and also the index of the records fetched to understand how it works
# The result will be records from StartIndex up to StartIndex+ MaxRecords
# Put in a UserList output and also its Count (Length)
Read here why not Count: https://itnext.io/which-property-to-see-if-a-query-has-results-9c51139084b5
2. Create pagination Web Block
# Put Data Action DataAction_GetUsers here with the same output with the Server Action GetuserList
3. Add Local Variables: SearchKeyword and StartIndex,
4. On Table List, add OnSort event handler - this also will add variable locals MaxRecords and TableSort. If there are two those variables, no worries, just delete others variable Local MaxRecords and TableSort.
4.1 Don't forget to set value to MaxRecords:
4.2 and also do refresh DataAction_GetUsers as required by OS:
5. Drag pagination widget to the PaginationBlock:
5.1 Set property StartIndex to local variable StartIndex
5.2 Set property MaxRecords to local variable MaxRecords
5.3 Set property TotalCount to DataAction_GetUsers.Count
5.4 Event handler for PaginationOnNavigate:
5.4.1 Assign StartIndex to NewStartIndex (do not reverse!!!)
5.4.2 Refresh Data Action DataAction_GetUsers
6. If there is a Search widget:
6.1 Remember to Reset the StartIndex to 0 and refresh Data Action DataAction_GetUsers:
That's it the main business. Here are the bonus:
1. if data is not fetched, loading spinner:
2. if data is fetched but empty then blank slate:
3. else (data fetched and not empty, show the result: