Code Monkey home page Code Monkey logo

Comments (8)

patrick-rodgers avatar patrick-rodgers commented on June 11, 2024 1

Paging is not supported as part of batching by design currently. That being said we can take a look and see what it would take to enable this. Might not be possible but I see what you are suggesting. Thanks!

from pnpjs.

patrick-rodgers avatar patrick-rodgers commented on June 11, 2024 1

Ok, I didn't understand that part then. Can you explain the use case where you would be looking to page through a collection in batches like this? I am not sure I understand the gain in doing so. If you are looking to get all the items in several lists I would recommend getAll().

from pnpjs.

nero120 avatar nero120 commented on June 11, 2024 1

Actually thinking about this more, my particular use case may not be a good example of the need to batch across multiple lists. I think the correct solution in my case is to combine into one list and just use separate content types (this is an upgrade to a legacy system which used separate lists, incorrectly imho). In that case, the current pnp batching functionality works fine and I can't really present a case for batching across multiple lists. There may be a good use case out there, in which case perhaps someone else who would want this functionality could contribute it?

In any case, I'll withdraw my request and close this. Thanks for your help @patrick-rodgers.

from pnpjs.

nero120 avatar nero120 commented on June 11, 2024

ok thanks for confirming @patrick-rodgers!

from pnpjs.

patrick-rodgers avatar patrick-rodgers commented on June 11, 2024

Hi @nero120 - I am circling back and looking at issues today. I misspoke, this will actually work as-is in the library as shown below. Meaning you can already do what you wanted :)

const b = sp.web.createBatch();

// get first set of results as part of a batch
sp.web.lists.getByTitle("BigList").items.inBatch(b).getPaged().then(result => {

    console.log(result.results.length);

    // get the second set of results from the first result instance
    result.getNext().then(result2 => {

        console.log(result2.results.length);
    });
});

b.execute();

from pnpjs.

nero120 avatar nero120 commented on June 11, 2024

@patrick-rodgers unfortunately you haven't answered the question as the second request is not issued as part of a batch request (i.e. the second request should be triggered by another call to b.execute()). If you were collecting results from multiple lists, your example implies that getNext for each list would need to be executed individually rather than part of a batch.

Can you please clarify and re-open if necessary?

from pnpjs.

patrick-rodgers avatar patrick-rodgers commented on June 11, 2024

Ok, thanks for the feedback and let us know if we can help out in the future.

from pnpjs.

github-actions avatar github-actions commented on June 11, 2024

This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.

from pnpjs.

Related Issues (20)

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.