The Sort & Paginate action breaks a large array into smaller chunks, displaying only a specific “page” at a time. You specify the number of items per page (per_page) and the current page (page), and it returns that portion of the array. This is useful for handling large datasets, such as Redis lists, in loops.
In addition to paginated items, it provides metadata like:
• Total items
• Total pages
• Current page
• Next and previous pages (if applicable)
The action supports sorting by different methods:
1. Number Sorting: Sorts numbers in ascending or descending order (e.g., 1, 3, 9 or 25, 12, 9).
2. Text Sorting: Sorts text based on lexicographical order, considering case differences unless specified (e.g., “Apple”, “Banana”, “Zebra”).
3. Natural Sorting: Sorts text with numbers in a human-readable way (e.g., “file1”, “file2”, “file10”).
4. Case-Insensitive Text Sorting: Ignores letter case when sorting text (e.g., “apple”, “Apple”, “Banana”).
5. Case-Insensitive Natural Sorting: Combines natural sorting with case insensitivity (e.g., “file1”, “File2”, “file10”).
This feature simplifies navigating and managing large datasets.