Data Table Pagination
Inkline's Data Table provides you with efficient automated pagination features.
Basic Pagination
Pagination is enabled by default and can be changed using the pagination attribute if needed.
Data Table Default Pagination
Show entries
10
25
50
100
| # | Name | Age | |
|---|---|---|---|
| 1 | Richard Hendricks | richard.hendricks@email.com | 26 |
| 2 | Bertram Gilfoyle | bertram.gilfoyle@email.com | 30 |
| 3 | Dinesh Chugtai | dinesh.chugtai@email.com | 30 |
| 4 | Jared Dunn | jared.dunn@email.com | 35 |
| 5 | Erlich Bachman | erlich.bachman@email.com | 32 |
| 6 | Nelson Bighetti | nelson.bighetti@email.com | 26 |
| 7 | Richard Hendricks | richard.hendricks@email.com | 26 |
| 8 | Bertram Gilfoyle | bertram.gilfoyle@email.com | 30 |
| 9 | Dinesh Chugtai | dinesh.chugtai@email.com | 30 |
| 10 | Jared Dunn | jared.dunn@email.com | 35 |
| # | Name | Age |
Showing 1 to 10 of 200 entries
- <
- 1
- 2
- 3
- 4
- …
- 20
- >
<i-datatable :columns="columns" :rows="rows" pagination />
export default {
data() {
return {
columns: [
{ title: 'Name', path: 'name', sortable: true },
{ title: 'Email', path: 'email', sortable: true },
{ title: 'Age', path: 'age', sortable: true }
],
rows: [
{ id: '1', name: 'Richard Hendricks', email: 'richard.hendricks@email.com', age: 26 },
{ id: '2', name: 'Bertram Gilfoyle', email: 'bertram.gilfoyle@email.com', age: 30 },
{ id: '3', name: 'Dinesh Chugtai', email: 'dinesh.chugtai@email.com', age: 30 },
{ id: '4', name: 'Jared Dunn', email: 'jared.dunn@email.com', age: 35 },
{ id: '5', name: 'Erlich Bachman', email: 'erlich.bachman@email.com', age: 32 },
{ id: '6', name: 'Nelson Bighetti', email: 'nelson.bighetti@email.com', age: 26 },
...
]
}
}
}
Disable Pagination
Pagination can be disabled by setting the pagination attribute to false.
Data Table Disabled Pagination
| # | Name | Age | |
|---|---|---|---|
| 1 | Richard Hendricks | richard.hendricks@email.com | 26 |
| 2 | Bertram Gilfoyle | bertram.gilfoyle@email.com | 30 |
| 3 | Dinesh Chugtai | dinesh.chugtai@email.com | 30 |
| 4 | Jared Dunn | jared.dunn@email.com | 35 |
| 5 | Erlich Bachman | erlich.bachman@email.com | 32 |
| 6 | Nelson Bighetti | nelson.bighetti@email.com | 26 |
| 7 | Richard Hendricks | richard.hendricks@email.com | 26 |
| 8 | Bertram Gilfoyle | bertram.gilfoyle@email.com | 30 |
| 9 | Dinesh Chugtai | dinesh.chugtai@email.com | 30 |
| 10 | Jared Dunn | jared.dunn@email.com | 35 |
| # | Name | Age |
<i-datatable :columns="columns" :rows="rows" :pagination="false" >
export default {
data() {
return {
columns: [
{ title: 'Name', path: 'name', sortable: true },
{ title: 'Email', path: 'email', sortable: true },
{ title: 'Age', path: 'age', sortable: true }
],
rows: [
{ id: '1', name: 'Richard Hendricks', email: 'richard.hendricks@email.com', age: 26 },
{ id: '2', name: 'Bertram Gilfoyle', email: 'bertram.gilfoyle@email.com', age: 30 },
{ id: '3', name: 'Dinesh Chugtai', email: 'dinesh.chugtai@email.com', age: 30 },
{ id: '4', name: 'Jared Dunn', email: 'jared.dunn@email.com', age: 35 },
{ id: '5', name: 'Erlich Bachman', email: 'erlich.bachman@email.com', age: 32 },
{ id: '6', name: 'Nelson Bighetti', email: 'nelson.bighetti@email.com', age: 26 },
...
]
}
}
}
Pagination Configuration
Pagination can be configured by providing an object for the pagination attribute. The default configuration is as follows:
export default {
...
data() {
return {
pagination: {
limit: { xs: 3, sm: 5 },
size: 'md',
variant: 'light',
rowsPerPage: 10,
rowsPerPageOptions: [10, 25, 50, 100]
}
};
}
}
<i-datatable :columns="columns" :rows="rows" :pagination="pagination" />
Async Pagination
Pagination can be handled asynchronously by setting the async attribute to true and providing an appropriate rows-count attribute.
This will tell the DataTable component to only display the rows and let the pagination handling be done asynchronously and externally using the update event.
The first update event occurs when the DataTable is created.
Data Table Async Pagination
Show entries
10
25
50
100
| # | Name | Age | ||
|---|---|---|---|---|
| # | Name | Age | ||
Showing 1 to 0 of 0 entries
<i-datatable async :columns="columns" :rows="rows" :rows-count="rowsCount" @update="onUpdate" />
export default {
data() {
return {
columns: [
{ title: 'Name', path: 'name', sortable: true },
{ title: 'Email', path: 'email', sortable: true },
{ title: 'Age', path: 'age', sortable: true }
],
rows: [],
rowsCount: 0
}
},
methods: {
onUpdate(event) {
getRowsAsync(event.page, event.rowsPerPage).then((response) => {
this.rows = response.data.rows;
this.rowsCount = response.data.rowsCount;
});
}
}
}