Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.
This repository was archived by the owner on May 29, 2019. It is now read-only.

Pagination: add custom page indexes #2532

@macluck

Description

@macluck

Hey!

I had to implement a pagination, where instead of page numbers, specific strings need to be displayed (first three letters of first and last item in the page). The only way to do it, was to tweak makePage function.

Currently the function is:

// Create page object used in template
      function makePage(number, text, isActive) {
        return {
          number: number,
          text: text,
          active: isActive
        };
      }

And when it is called, the number is passed as a text:

// Add page number links
        for (var number = startPage; number <= endPage; number++) {
          var page = makePage(number, number, number === currentPage);
          pages.push(page);
        }

So what I did, is added an extra attribute to the directive, to which I can pass an array with the pagination indexes (separately prepared in a backend, with same size as number of total pages). These values are added when the page is created.

Do you you think it could be a good idea, to add the new attribute, which can be responsible for overriding default number pages? In that case, of course, preparation of valid values for override is a developer's responsibility.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions