Added HTMX paging example.

This commit is contained in:
mikestefanello 2021-12-24 17:58:53 -05:00
parent 677193ccba
commit b29de840f9
4 changed files with 86 additions and 15 deletions

View file

@ -61,18 +61,18 @@ func (p *Pager) SetItems(items int) {
}
// IsBeginning determines if the pager is at the beginning of the pages
func (p *Pager) IsBeginning() bool {
func (p Pager) IsBeginning() bool {
return p.Page == 1
}
// IsEnd determines if the pager is at the end of the pages
func (p *Pager) IsEnd() bool {
func (p Pager) IsEnd() bool {
return p.Page >= p.Pages
}
// GetOffset determines the offset of the results in order to get the items for
// the current page
func (p *Pager) GetOffset() int {
func (p Pager) GetOffset() int {
if p.Page == 0 {
p.Page = 1
}