I only want pagination of datatable to work, I used code in documentation here it is:
request ({ pagination }) {
// we set QTable to "loading" state
this.loading = true
// we do the server data fetch, based on pagination and filter received
// (using Axios here, but can be anything; parameters vary based on backend implementation)
axios
.get(`/api/`+this.dataSource+`/?page=${pagination.page}`,{ headers: { Authorization: 'Bearer '.concat(localStorage.getItem('token')) } })
.then(response => {
// updating pagination to reflect in the UI
this.serverPagination = pagination
// we also set (or update) rowsNumber
this.serverPagination.rowsNumber = response.data.data.data.rowsNumber
// then we update the rows with the fetched ones
this.tableData = response.data.data.data
// finally we tell QTable to exit the "loading" state
this.loading = false
})
.catch(error => {
// there's an error... do SOMETHING
// we tell QTable to exit the "loading" state
this.loading = false
})
}
and in laravel api used this code
`/api/`+this.dataSource+`/?page=${pagination.page}`,{ headers: { Authorization: 'Bearer '.concat(localStorage.getItem('token')) } }
it returns data for the first page but datatable's arrow buttons are disabled, Despite the existence of other data.
thanks in advance
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire