GithubHelp home page GithubHelp logo

Adding prev to cursors about fractal HOT 6 CLOSED

thephpleague avatar thephpleague commented on August 15, 2024
Adding prev to cursors

from fractal.

Comments (6)

philsturgeon avatar philsturgeon commented on August 15, 2024

I do wonder how necessary it is. Do people walk through data in both directions in this sort of scenario?

I mean, I guess so? We can blindly copy Facebook and do it?

Sent from Mailbox for iPhone

On Tue, Apr 8, 2014 at 3:57 AM, Michele Massari [email protected]
wrote:

Hi Phil!
Will it make sense in your opinion to add a "prev" parameter to the cursor so the output can be like this?
"cursor": {
"current": "MTA=",
"prev": "LTEw",
"next": "MTA=",
"count": 10
}
I made some slight changes to the CursorInterface, Cursor, Scope and Collection because I needed the functionality for a personal project.

If you want I can make a pull request to let you review it.

Reply to this email directly or view it on GitHub:
#40

from fractal.

mikemassari avatar mikemassari commented on August 15, 2024

It was requested by the mobile app developer to implement a "prev" button on the list pagination.
Of course if you don't think it's useful there's no need to implement it. :)

from fractal.

philsturgeon avatar philsturgeon commented on August 15, 2024

I was just curious but that is an obvious use case. Go for it! :)—
Sent from Mailbox for iPhone

On Tue, Apr 8, 2014 at 1:27 PM, Michele Massari [email protected]
wrote:

It was requested by the mobile app developer to implement a "prev" button on the list pagination.

Of course if you don't think it's useful there's no need to implement it. :)

Reply to this email directly or view it on GitHub:
#40 (comment)

from fractal.

ipalaus avatar ipalaus commented on August 15, 2024

Yeah, I think it would be a nice addition too. What if you're not using it, it will just be always null? How would you handle that?

from fractal.

mediaholding avatar mediaholding commented on August 15, 2024

I think it is very important to update Cursor docs at http://fractal.thephpleague.com/pagination/ because sample code now isn't work because of additional parameter prev.

This line:

$cursor = new Cursor($currentCursorStr, $newCursorStr, $books->count());

should be now something like that:

$cursor = new Cursor($currentCursorStr, $prevCursorStr, $newCursorStr, $books->count());

from fractal.

philsturgeon avatar philsturgeon commented on August 15, 2024

I'm not sure how to do that with the current ID-based example. If you use cursors and use offsets would you be so kind as to change it to use offsets and send a PR?

from fractal.

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.