fastforward's avatar

Custom pagination number of pages before dots (...)

Hello, I made custom pagination style by extending BootstrapThreePresenter and I have one small issue. By default pagination full url range multiplier is 3, and I want to change it, because 8 pages until first dots (...) are abit too much. I couldn't find a way without changing it in source files, any ideas how and if its even possible to change? You can find it in Illuminate\Pagination\UrlWindow

For now pagination looks like this - 1 2 3 4 5 6 7 8 ... 20 21 But I need like - 1 2 3 4 5 6 ... 20 21

0 likes
5 replies
midascodebreaker's avatar

i already asked that question here no one is knowledgeable enough to answer with clarity... most common problem with pagination but left unanswered

SaeedPrez's avatar

i already asked that question here no one is knowledgeable enough to answer with clarity... most common problem with pagination but left unanswered

@midascodebreaker did you actually watch the video @Snapey posted or are you here just to complain about not getting FREE help?

Just because your question was unanswered, it doesn't mean no one here is knowledgeable (and you are not very wise to insult the very people you expect FREE help from), there are plenty of knowledgeable people here and problems much larger and more complicated than yours get solved, so most likely they didn't see it or chose not to answer (maybe because of your attitude).

usman's avatar

@fastforward you can simply override the constructor of your presenter to achieve this:

public function __construct(PaginatorContract $paginator, UrlWindow $window = null)
    {
        $this->paginator = $paginator;
        $this->window = is_null($window) ? UrlWindow::make($paginator, 2) : $window->get();
    }

Note the argument i.e 2 it will reduce the links to 6 before dots.

Usman.

Please or to participate in this conversation.