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

Pagination: add custom page indexes #2532

Closed
macluck opened this issue Jul 31, 2014 · 1 comment
Closed

Pagination: add custom page indexes #2532

macluck opened this issue Jul 31, 2014 · 1 comment

Comments

@macluck
Copy link

macluck commented Jul 31, 2014

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.

@ashaffer
Copy link
Contributor

+1 for this feature.

Another option is for the attribute to just provide a function that returns the text for a specified index. Either way this feature would be very desirable.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants