Skip to content

Commit

Permalink
a couple of how_to additions
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Jun 14, 2020
1 parent 53d2167 commit 8673ca4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/how-to.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ pagy.series
#=> []
```
### Customizing the series
If changing the `:size` is not enough for your requirements (e.g. if you need to add intermediate segments or midpoints in place of gaps) you should override the `series` method. See more details and examples [here](https://github.com/ddnexus/pagy/issues/245).
## Passing the page number
You don't need to explicitly pass the page number to the `pagy` method, because it is pulled in by the `pagy_get_vars` (which is called internally by the `pagy` method). However you can force a `page` number by just passing it to the `pagy` method. For example:
Expand Down Expand Up @@ -516,6 +520,10 @@ For better performance of grouped ActiveRecord collection counts, you may want t

When the count caching is not an option, you may want to use the [countless extra](extras/countless.md), which totally avoid the need for a count query, still providing an acceptable subset of the full pagination features.

## Using AJAX

See [Using AJAX](api/javascript.md#using-ajax)

## Paginate for API clients

When your app is a service that doesn't need to serve any UI, but provides an API to some sort of client, you can serve the pagination metadata as HTTP headers added to your response.
Expand Down

0 comments on commit 8673ca4

Please sign in to comment.