# Pagination
ProTable provides you a pagination feature out of the box. On this guide, we will show you variety ways to customize the pagination.
# Disable Pagination
Without any configuration, the pagination is enabled by default. However, if you want to disable it, you can pass false to pagination options:
import { fromArray } from 'protable'
const data = [
// data
]
fromArray('#table-id', data, {
pagination: false
})
# Simple Pagination
ProTable has two pagination types. If you don't set any of them, it will give you the default one. But, if you prefer a simple pagination that only contains two buttons (prev and next button), you can explicitly set the type like this:
fromArray('#table-id', data, {
pagination: 'simple'
})
Or like this:
fromArray('#table-id', data, {
pagination: {
type: 'simple'
}
})
ProTable output:
No ▴▾ | Name ▴▾ | Gender ▴▾ | Email ▴▾ | Phone ▴▾ |
|---|---|---|---|---|
| 1 | Greta Hays | female | [email protected] | +1 (856) 440-3124 |
| 2 | Peters Suarez | male | [email protected] | +1 (887) 464-2619 |
| 3 | Cecilia Moss | female | [email protected] | +1 (993) 448-3558 |
| 4 | Carissa Hoover | female | [email protected] | +1 (854) 533-2459 |
| 5 | Cathleen Wells | female | [email protected] | +1 (959) 510-3025 |
Rows per page 1-5 of 336 | ||||
# Rows Limit
By default, the rows limit for each page is 10. You can change this behavior by setting limit value in options parameter.
ProTable.fromArray('#protable', data, {
limit: 5
})
# Page Ranges
The default value of pagination page ranges is [5, 10, 25, 50, 100, 250, 500]. You change this behavior by setting pagination.ranges value in options parameter.
ProTable.fromArray('#protable', data, {
limit: 5,
pagination: {
rowsPerPage: {
ranges: [5, 8, 12, 30]
}
}
})
# Rows Per Page Label
To change "Rows Per Page" label, you pass a string to pagination.text attribute.
ProTable.fromArray('#protable', data, {
limit: 5,
pagination: {
rowsPerPage: {
text: 'Limit',
ranges: [5, 8, 12, 30]
}
}
})
Here's the ProTable output of above settings:
No ▴▾ | Name ▴▾ | Gender ▴▾ | Email ▴▾ | Phone ▴▾ |
|---|---|---|---|---|
| 1 | Greta Hays | female | [email protected] | +1 (856) 440-3124 |
| 2 | Peters Suarez | male | [email protected] | +1 (887) 464-2619 |
| 3 | Cecilia Moss | female | [email protected] | +1 (993) 448-3558 |
| 4 | Carissa Hoover | female | [email protected] | +1 (854) 533-2459 |
| 5 | Cathleen Wells | female | [email protected] | +1 (959) 510-3025 |
Limit | ||||
← Custom Content Sort →