Comments (7)
Currently, djResource
does not support opting out of auto-pagination when it receives object-encapsulated list responses with a next
property.
As a workaround, I suggest creating a custom pagination serializer for your view that uses a property named something other than next
as its NextPageField
. See this paragraph for a quick guide on creating a custom pagination serializer.
It does sound reasonable to want to support on-demand iteration of result pages, so I'll leave this ticket open as an enhancement request for such a feature. Thanks!
from angular-django-rest-resource.
👍
from angular-django-rest-resource.
+1 this is somewhat unexpected/confusing behavior
from angular-django-rest-resource.
+1 for this issue.
If the API returns thousands of objects, it can be a problem because we would need too many http requests, and we are forced to wait for a long time before the results are rendered.
If we can opt-out the auto-pagination feature, we still need a way to deal with pagination.
I'm just learning angular and I don't even understand the full resource code, I wish I could help you with this.
I'm totally stuck with this issue. If I use a custom pagination, how could I request the next page? or get the number of pages available for creating a nice paginator?
from angular-django-rest-resource.
This would be an awesome feature, but it needs someone with enough knowledge of angular + django rest framework to take it on
from angular-django-rest-resource.
Okay I had a look at this. I don't think the recursivePaginator serves everyone's expectations. The workaround (to build on @JustinTArthur's comment above) for me was to simply make an empty CustomPaginationSerializer (just override BasePaginationSerializer then pass), and add that to your generic view. This way you avoid including 'count' in your resource, and so you never hit the paginator. You can then go on and request more pages manually, as need be. You will also need to transform the response, mid-flight, in your services, like:
query: {method: 'GET',
transformResponse: function(data, headers){
data = angular.fromJson(data);
data = data.results;
return data;
},
isArray: true
},
Ugh. I'd still like to add on-demand pagination to this code, because in every other way it is fantastic.
from angular-django-rest-resource.
Any chance this will get implemented? I will be dealing with multiple thousands of rows and I plannig to use angular ui-grid with external pagination done by DRF.
from angular-django-rest-resource.
Related Issues (15)
- Allow trailing slashes in configured resource URL
- save() 405 method not allowed HOT 4
- Fetch related objects HOT 1
- Trailing / now in AngularJS HOT 2
- lib as patches
- Bower version is not up-to-date with this repo HOT 1
- Auto-paginate when array-promising actions receive paginated response.
- Result promise HOT 4
- 'Argument 'fn' is not a function, got object' error when response contains more then one page HOT 1
- Please post some better examples on how to use this
- [enhancement] Add missing bower.json.
- Add a test.
- An injection example would be very helpful HOT 2
- Last page of paginated request HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-django-rest-resource.