Skip to content

pikajude/yesod-pagination

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yesod-pagination

(yesod-paginate is taken)

This package makes it pretty simple to paginate records.

You'll probably want to use the function paginateWith, which takes an esqueleto query and gives you Handler (Page r). The returned Page object might have next page and previous page links (pre-rendered).

The most trivial example of an esqueleto query is return (paginate is basically paginateWith return). This one is a bit less trivial.

import Import
import Yesod.Paginate

getMessagesR :: Handler Html
getMessagesR = do
    myMessages <- paginateWith $ \msg -> do
        orderBy [asc (msg ^. MsgCreatedAt)]
        return msg

    defaultLayout $(widgetFile "message-list")

For a lesson on how to write esqueleto queries, see the haddocks.

About

pagination for yesod c:

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published