Open makz27 opened 7 years ago
I also had the same issue, I ended up changing the meta to have total_pages instead of total and messages seemed to go away.
For your issue with still being able to click the disabled next button, I had the same issue. I found that I was sending over a float as the total_pages in the meta. Once I switched to int, the next button was no longer clickable once I got to the end. I would think the library would check type and convert to int if needed.
-- Jeremy
Is this still the case in v3.0.0 ?
Yep same problem for me. Maybe because my pagination is inside content->meta->pagination->total_pages
but i have no power on this, dingo/api return me this structure.
I also had the same issue, I fixed this by normalizing the server's response, by adding this code in application's controller.
normalizeQueryResponse(store, clazz, payload) { const result = this._super(...arguments); result.meta.total_pages = result.meta.total_pages || {}; if (payload.meta) { result.meta.total_pages = payload.meta.pagination.pages; } return result; }
I also had the same issue, I fixed this by normalizing the server's response, by adding this code in application's controller.
normalizeQueryResponse(store, clazz, payload) { const result = this._super(...arguments); result.meta.total_pages = result.meta.total_pages || {}; if (payload.meta) { result.meta.total_pages = payload.meta.pagination.pages; } return result; }
used the same code with some changes.
result.meta.total_pages = result.meta.total_pages
to result.meta.pagination.total_pages
information is in meta.pagination because we use dingo
normalizeQueryResponse(store, ModelClass, payload) {
const result = this._super(...arguments);
result.meta.total_pages = result.meta.pagination.total_pages || {};
if (payload.meta) {
result.meta.total_pages = payload.meta.pagination.total_pages;
}
return result;
}
Hello,
My api send me this structure
Following the dummy test here's my controller
and my route
The pagination is good, but i can click on next page even if the next page is empty (6 records on a total of 50 items, only one page)
and here's the console log
Did i miss something ?
Thank you.
EDIT
In fact, the "next arrow" have the class "disabled" but i can still click on this (maybe a simple template error), but it's always disabled even if i have a next page. maybe because totalPages is undefined.