Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow callback for rendering page numbers #65

Open
jamesheazlewood opened this issue Jan 9, 2019 · 0 comments
Open

Allow callback for rendering page numbers #65

jamesheazlewood opened this issue Jan 9, 2019 · 0 comments

Comments

@jamesheazlewood
Copy link

jamesheazlewood commented Jan 9, 2019

For example, if I want to add an icon or add commas for thousands (1,002 1,003 etc) for large page numbers.

<Pagination
   prevPageText="Prev"
   nextPageText="Next"
   firstPageText="First"
   lastPageText="Last"

   numberText={i => commas(i)}

   innerClass="pagination"
   itemClass="page-item"
   linkClass="page-link"
   activePage={activePage}
   itemsCountPerPage={pageSize}
   totalItemsCount={totalRecords}
   onChange={pageNumber => {
      handlePageChange(pageNumber, pageSize, tableIdentifier);
   }}
/>

Potential changes:

for (
      let i = paginationInfo.first_page;
      i <= paginationInfo.last_page;
      i++
    ) {
      pages.push(
        <Page
          isActive={i === activePage}
          key={i}
          href={getPageUrl(i)}
          pageNumber={i}

          pageText={numberText ? numberText(i) : i + ""}

          onClick={onChange}
          itemClass={itemClass}
          linkClass={linkClass}
          activeClass={activeClass}
          activeLinkClass={activeLinkClass}
        />
      );
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant