GithubHelp home page GithubHelp logo

Comments (7)

JustinTArthur avatar JustinTArthur commented on August 17, 2024

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.

rsaikali avatar rsaikali commented on August 17, 2024

👍

from angular-django-rest-resource.

anton-107 avatar anton-107 commented on August 17, 2024

+1 this is somewhat unexpected/confusing behavior

from angular-django-rest-resource.

AdrianRibao avatar AdrianRibao commented on August 17, 2024

+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.

ashleyblackmore avatar ashleyblackmore commented on August 17, 2024

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.

ashleyblackmore avatar ashleyblackmore commented on August 17, 2024

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.

scholtalbers avatar scholtalbers commented on August 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.