You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 4, 2021. It is now read-only.
We're using a project with OData currently. But it would be nice to have this project support the "$skip" param instead of the current "currentpage" param.
OData uses "$top" (pagelimit) and "$skip" (currentpage * pagelimit) to create data offsets. It's a simple implementation next to the current and would be nice to have!
The text was updated successfully, but these errors were encountered:
I too ran into this problem. I had to implement my own solution:
state: {firstPage: 0,currentPage: 0,pageSize: 5,offset: 0},queryParams: {pageSize: 'limit',// LIMIT in SQL speakstart: 'after'// OFFSET in SQL speak},getOffset: function(){console.log('getOffset:',this.state);returnthis.state.currentPage*this.state.pageSize;},fetch: function(options){if(!options){options={};}if(options['data']){options['data']['after']=this.getOffset();}else{options['data']={'after': this.getOffset()};}returnPaginatedCollection.prototype.fetch.call(this,options);}
All the terminology here is annoying if you're used to offset/limit terminologies. The API I'm using uses the terms "after/limit" while backbone.paginator uses "start/pageSize" but SQL uses "offset/limit".
So far this seems to work as expected but do I get unnecessary query params in my API request. I can live with that...
If I'm not wrong, the example from the readme solves this nice and succinctly? (I think that's where I first found it?)
queryParams: {pageSize: "limit",// Setting a parameter mapping value to null removes it from the query stringcurrentPage: null,// Any extra query string parameters are sent as is, values can be functions,// which will be bound to the pageable collection instance temporarily// when called.offset: function(){returnthis.state.currentPage*this.state.pageSize;}},
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
We're using a project with OData currently. But it would be nice to have this project support the "$skip" param instead of the current "currentpage" param.
OData uses "$top" (pagelimit) and "$skip" (currentpage * pagelimit) to create data offsets. It's a simple implementation next to the current and would be nice to have!
The text was updated successfully, but these errors were encountered: