Questions tagged [pagination]

Pagination is the process of dividing information into discrete pages.

Filter by
Sorted by
Tagged with
12 votes
1 answer
3k views

Creating a page number array for pagination

I have written a small function to generate an array of page numbers for displaying a pagination. The inputs to the function is an active page number p, and the max page number. The function will ...
rahul's user avatar
  • 243
11 votes
4 answers
496 views

Cutting it to Pages

I was working on representing a large List of information on a number of different pages, and a colleague of mine suggested that I try to make a generic method for ...
bazola's user avatar
  • 8,579
10 votes
2 answers
17k views

Pagination algorithm in JS

I needed a relatively simple pagination, as currently implemented on GoogleSearch (sans prev & next buttons). Most code I've seen was overly complicated so I came up with something that's simpler. ...
Robert's user avatar
  • 201
10 votes
1 answer
561 views

Simple pager in C

I have written a simple pager in C. It works fine for most things, but I'd like to know how it can be improved. Specific things I'm looking for are if there are size and/or speed improvements to be ...
user avatar
9 votes
1 answer
5k views

RSpec test for pagination

This is a Rspec test for pagination in Rails project. I'm not sure if I should write the test in spec/requests or ...
ironsand's user avatar
  • 171
8 votes
1 answer
429 views

Non-curses pager in C

I have written a pager in C that is supposed to be used in systems where curses is not installed (or broken). It can also be used as a system-wide pager, it works ...
user avatar
8 votes
1 answer
19k views

Paginating large SQL-Results

It feels like pagination is one of the most discussed questions on the web, which always ends up with some quick and dirty hacks on how to paginate. I want to paginate a large result set from an SQL ...
yankee's user avatar
  • 498
8 votes
1 answer
3k views

GET with paging, sorting and filtering

I have a GET method that handles paging, filtering, and sorting. Development has been fairly rapid and I'm not completely sold on some of the implementation. A few assumptions have to be made for this ...
G. J.'s user avatar
  • 83
8 votes
2 answers
1k views

Infinite scroll pagination with a Wookmark layout

...
brewern's user avatar
  • 81
8 votes
1 answer
281 views

Streaming pages of a different size than a cache's pages

I need to write a service to return objects in pages of size 20. The caching of these objects is done in pages of size 60. To abstract the logic of streaming differently-sized pages, I wrote this <...
Paul Bellora's user avatar
8 votes
2 answers
499 views

Pagination plugin

This plugin is written in jQuery and is made to support the codeigniter framework. It is an ajax powered table pagination plugin designed to provide only that. You should be able to use almost any ...
Hailwood's user avatar
  • 477
7 votes
2 answers
2k views

Version of C# StringBuilder to allow for strings larger than 2 billion characters

In C#, 64bit Windows, .NET 4.5 (or later), and enabling gcAllowVeryLargeObjects in the App.config file allows for objects larger than two gigabyte. That's cool, but ...
Dan W's user avatar
  • 173
7 votes
1 answer
358 views

Collecting friends' wall posts

Originally, I had everything in the base method #read_wall(). I'm not sure what happened with the array, but when I tried: array = result + second + third + fourth....
user2197's user avatar
  • 171
7 votes
1 answer
682 views

Setting up pagination links inside a WebAPI Controller

I'm implementing paging for the first time and have the following code which achieves what I want. There are just a couple of things that feel a bit weird to me and would like if somebody could give ...
TomSelleck's user avatar
7 votes
1 answer
4k views

Java 8 spliterator for paged results

Summary: I am using an API which returns paged results. I want to have these results as Java 8 Stream and implemented a ...
lexicore's user avatar
  • 223
6 votes
3 answers
263 views

Python grouped iterator

I wanted to write an iterator that would split items up into groups, so I can bulk insert into MySQL without crashing or overwhelming the server. This is the implementation I came up with. I am hoping ...
Ben's user avatar
  • 181
6 votes
3 answers
2k views

Generating pagination links

I recently had an interview for a programming job and after the interview I was then asked to create a function with the following brief: The Task: Relating to pagination links: given a page number, ...
no.'s user avatar
  • 297
5 votes
1 answer
3k views

Pagination implementation for a blog system

Last night I was working on a project that I've embarked upon as a learning exercise. I decided to add a pagination feature to my blog system. I made an attempt at it and got close... but I decided to ...
Dan Beaulieu's user avatar
5 votes
1 answer
1k views

Pagination PHP function - Can this code be made more efficient?

First of all, I didn't write this code from scratch, I'm pretty sure I took it from an online tutorial and modified it slightly to suit my needs. Can the code be improved in any way? I feel it's quite ...
Michael LB's user avatar
5 votes
2 answers
3k views

Adding a bulk of items in the middle of a sparse array

I'd like to add a bulk of items into a sparse array, starting at a certain index. I came along this requirement in order to accomplish client side pagination while not retrieving all data from server (...
user40171's user avatar
  • 187
5 votes
2 answers
559 views

Rails guestbook with new, index, and Kaminari pagination in the same method

I created a guestbook that on one page displays both the form for a new entry and all of the entries that have been created so far. I am trying to use Kaminari for pagination for the entries. Right ...
Jack's user avatar
  • 51
5 votes
1 answer
213 views

Paginating blog posts from SQL server using nested LINQ statements

I made an ASP.NET MVC application using Entity Framework for code-first migrations to the SQL Server database. I also use Unity (DI/IoC) for managing the services and repositories. I made an overview ...
H. Pauwelyn's user avatar
5 votes
1 answer
152 views

Related links for WordPress posts

I have written the following class which is part of a pagination system in Wordpress. The class works as expected and also works as expected when used in the system. Just as background, the class ...
Pieter Goosen's user avatar
5 votes
1 answer
863 views

Pagination of repeater

I have some problems in my View.ascx.cs file because I'm reusing my code and modified it based on the situation. For example, when I apply pagination I have different code in all places. I just want ...
NinjaDeveloper's user avatar
5 votes
1 answer
607 views

how to make pagination more efficient with large arrays and db support

i have a pagination library in php. i want to know: how can i make it more efficient when passing large arrays into the constructor how can i add db support paginator.php ...
shorif2000's user avatar
5 votes
1 answer
2k views

React app with table, search & pagination

I'm new to React. I major in Angular. And for me it's realy not so obvious here... Do I use this props & state variables in a good way or do I need to refactor/change something? Main goal is such:...
pavel's user avatar
  • 151
5 votes
1 answer
875 views

Laravel Pagination with haversine formula in it

I'm using the haversine formula to count distance from selected post-code to desired destination. I have the following scope in ...
rkd.me's user avatar
  • 96
5 votes
1 answer
168 views

GitHub API client

Here is my Haskell program designed to list all of my GitHub repos along with their descriptions and languages via the GitHub JSON APIs: ...
Richard Cook's user avatar
4 votes
3 answers
143 views

Setting the page number with a default

Consider this code segment: if (empty($_GET)) { $page_number = 1; } else { $page_number = $_GET["page_number"]; } I wonder if there is a better, more ...
Hai Vu's user avatar
  • 650
4 votes
2 answers
3k views

Pagination algorithm based on scores

I need to divide scoreResult into pages (which is already ordered by score column from highest to lowest), and each page cannot contain too many records (e.g. 12 is ...
Lin Ma's user avatar
  • 3,433
4 votes
1 answer
5k views

WebApi Get with paging

How can I improve this code? ...
Roman Marusyk's user avatar
4 votes
3 answers
552 views

Page Enum with overridden methods for the first and last members

I am managing the changing of views in an Android app using this enum and associated methods. I am particularly interested in the Page enum's use of overriding <...
Derek's user avatar
  • 225
4 votes
1 answer
2k views

Change the limit from CakePHP 3 Paginator by click in link inside an <option>

I'm using the CakePHP 3.0 to paginate some content, but I can't find a way to change the limit (user on browser choose the limit of content displayed on screen) using ...
Ricardo's user avatar
  • 265
4 votes
1 answer
176 views

Determining if there is data left after fetching a page of data

I just faced a problem where I needed to know if extra data was present in a given collection after a Take operation took place. Specifically, this is related to ...
julealgon's user avatar
  • 224
4 votes
1 answer
394 views

Optimizing pagination of HTML tables

I'd like to share my implementation to you to confirm if it's a correct way to solve my problem. I have a list of products which have an attributes table and a description table (both in html_encoded ...
Anonymous's user avatar
  • 141
4 votes
1 answer
80 views

Paginating API with "next" Pythonically

I'm wondering if there's a more Pythonic way to keep paginating an API endpoint until there's no next key in the response. The thing that bothers me the most is the ...
zerohedge's user avatar
  • 155
4 votes
1 answer
2k views

Joining huge CSV files and splitting the result into batches

I've got ~20GB of data about the same subject, concatenated from small files of 16kB, each produced by different measurement equipment. They share some headers (on the example: B, D & E) and they ...
Thomas Ayoub's user avatar
4 votes
1 answer
522 views

Github pagination

I wanted to copy the behavior of github's pagination. Here is what it turned out: http://jsbin.com/dihohiseca/5/edit?js,output It works fine, but I have a feeling that there is a lot of room for ...
user3568719's user avatar
3 votes
1 answer
1k views

Pagination calculation

I have written a function to get the actual page range to display that page range in pagination. My function is working properly. But I think that I have written bad code. Can someone review my code ...
Vishal's user avatar
  • 197
3 votes
1 answer
773 views

WAI-ARIA and Pagination

I would like to get some advice on WAI-ARIA markup I have added to my paginated post navigation. Does this look correct, am I missing anything? Should anything be added/removed to the current page ...
Benjamin's user avatar
  • 131
3 votes
1 answer
22k views

WPF ListView Pagination using MVVM Pattern

A few days ago, I was looking for simple pagination example and I decided to write my own version. It is one of my first apps using MVVM Pattern, so I am not sure I did right. I would appreciate if ...
Dess's user avatar
  • 31
3 votes
1 answer
103 views

Searching for news articles in database

The first thing I would like to say is that I do have a fully functioning script, but the script is ugly, and I am wondering if there is a way to optimize it. The script looks to see if I have at ...
Dwight Aaron Potvin's user avatar
3 votes
1 answer
115 views

Pagination helper class

The most nauseous problem with pagination is the fact that you have to write two almost identical queries. For the various reasons I am not inclined to use the SQL-only way (such as ...
Your Common Sense's user avatar
3 votes
1 answer
105 views

PHP complete pagination code

I'm working on a site where you can read about different songs, listen to them, rate them etc, same with their singer. I've been thinking about how I could create a simple, yet perfectly working ...
K. P.'s user avatar
  • 243
3 votes
1 answer
342 views

React pagination without JSX

I've published my first react project for pagination purposes. It's likely I'm making mistakes or there are any improvements to my code. I'd appreciate if anyone has any offers. ...
Ghasem's user avatar
  • 133
3 votes
1 answer
2k views

Generic paging algorithm

I have made a simple pagination algorithm. It shows "next" and "previous" buttons when appropriate. It also limits the amount of buttons if the page amount exceeds a certain amount, e.g. ...
Johan's user avatar
  • 33
3 votes
1 answer
1k views

AngularJS application to display 10 search results at a time

I am working on an angular application. I have written a controller for a page which gets 10 objects from an api. On clicking the next button, it gets the next 10 objects and so on. I have also added ...
doctorsherlock's user avatar
3 votes
1 answer
2k views

Paginate a long unordered list

I'm working in an application where there's a long unordered list of items that have to be paginated. New items are added to the list regularly, and the items come from a database. The only control I ...
Larz's user avatar
  • 275
3 votes
2 answers
1k views

Pagination filtering

I want to check if there is page variable (in URL) and if it is, if it's correct - it cannot be number 1 because this is default page and it should be valid int ...
Marcin Nabiałek's user avatar
3 votes
1 answer
887 views

Implementing pagination with three modules

I am utilizing CodeIgniter's Pagination class to implement pagination in the project. In this project, there are 3 modules: Event, Business and Parts. Each Module has the same "view" for pagination. ...
Vaibhav's user avatar
  • 131