question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Limit number of elements | Pagination Support

See original GitHub issue

Can an option to be added to how many elements that can be added when using:

  • beforebegin
  • afterbegin
  • beforeend
  • afterend

with the option to prepend, append and ignore newer times. When prepend and append the oldest item will be removed when the limit is hit.

Also add the ability to:

  • specify an ID range or list of item to display based on a state or variable - if returned IDs are outside the list they will not be displayed
  • request multiple times - range or the list of items can be specified as variables
  • update specific items at particular indices - IDs can be returned in the response header. IDs not in already present can be ignored, prepended or appended.
  • insert specific items at particular indices - IDs of adjacent items can be returned in the response header. If items are not adjacent. new items will not be inserted to prevent double insertion.
  • delete specific items at particular indices - IDs can be returned in the response header

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:31 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
benpatecommented, Aug 22, 2020

FWIW, my demo site finally works. Check out http://sseplaceholder.openfollow.org as an example of the SSE and Pagination experiments I’m doing. When I get close to a real solution for infinite scrolling, I’ll try to put it there, too.

1reaction
benpatecommented, Feb 24, 2021

Hi @paxperscientiam -

My original thought at the time was that hx-prev and hx-next would be full URLs. That would take all of the guessing out of arguments and URL formats. For example, if I’ve just called /my-rul?page=2, its response might look something like:

<div hx-prev="/my-url?page=1" hx-next="/my-url?page=3">...</div>

This would work just as well as if I’m using a more “rails-ish” syntax. So, if I’ve just called /page/2, then my responses might be:

<div hx-prev="/page/1" hx-next="/page/3">...</div>

And so on…

With that said, I don’t think this concept went anywhere. It’s interesting, but it didn’t get enough traction to actually make it into code. You could lobby @1cg to advocate for this feature. I think it would be pretty straightforward to do, if it ever does get “blessed.”

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to limit number of element per page using jquery
1 Answer 1 ... It's called "pagination". You will find tons of jQuery Plugins for that purpose. ... compares 10 plugins, see if...
Read more >
How to: pagination with different limit for first page - ProcessWire
The first page should show a list of 8 items. After that all following pages should have a limit of 10 items. page...
Read more >
How To Limit and Paginate Query Results in Laravel Eloquent
In this part of the series, you'll learn how to limit the number of results in a Laravel Eloquent query with the limit()...
Read more >
Search result pagination | Meilisearch Documentation v0.30
limit sets the size of a page. If you set limit to 10 , Meilisearch's response will contain a maximum of 10 search...
Read more >
Pagination (Reference) - Prisma
Prisma Client supports both offset pagination and cursor-based pagination. Learn more about the pros and cons of different pagination ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found