Skip to content

Pagination on Custom MySQL Query : any ideas ? #7313

Answered by melohagan
poirazis asked this question in Help
Discussion options

You must be logged in to vote

Hi @poirazis

Paginating the results from a custom query in MySQL is fairly straight forward.

Data

Fetch your table. In my case it's a table of people names A-Z.
Next create a query with a binding for LIMIT and OFFSET. I'm using a basic select * from ... but this should work for more complicated queries as well.

Design

Add a Form, Data Provider (Paginate query), Table.
Under the table add a container to hold a back and next button, with a number field in between.

Give the page number field a name, and default value of 1.
Click to cog icon on the data provider, and add a JavaScript binding for the offset.

return ($("Form.Fields.Page")-1) * 5

multiply by your limit, in this case 5

Add con…

Replies: 3 comments 17 replies

Comment options

You must be logged in to vote
5 replies
@poirazis
Comment options

@R2bEEaton
Comment options

@poirazis
Comment options

@poirazis
Comment options

@melohagan
Comment options

Comment options

You must be logged in to vote
11 replies
@melohagan
Comment options

@ashik-entym
Comment options

@daraul
Comment options

@melohagan
Comment options

@R2bEEaton
Comment options

Answer selected by melohagan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
5 participants