GithubHelp home page GithubHelp logo

wwwaiser / react-js-pagination Goto Github PK

View Code? Open in Web Editor NEW
353.0 353.0 95.0 9.46 MB

Home Page: http://vayser.github.io/react-js-pagination

License: Creative Commons Zero v1.0 Universal

JavaScript 99.07% HTML 0.76% Less 0.17%
pagination react-component react-components

react-js-pagination's People

Contributors

boxfoot avatar dependabot[bot] avatar deptno avatar ened avatar hownowbrowncow avatar ipostol avatar lluiscab avatar mikeflame avatar wagoid avatar wwwaiser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-js-pagination's Issues

click on the page button then go to home page.

Hi, there! I found a problem in some situations. Each page button has a 'href' attr with value '#', when I click on it, instead of next page in current route, the location change to home page. But in some other websites, it works well.
I don't know how it happened for now, but I think you may change the href as 'javascript:void(0);', this can work in any situation.

The boolean hideFirstLastPages doesn't hide the First or Last Pages

I believe this issue lies within the functions that check for page visibility:

  isFirstPageVisible(has_previous_page) {
    const { hideDisabled, hideNavigation, hideFirstLastPages } = this.props;
    return !hideNavigation && !hideFirstLastPages && !(hideDisabled && !has_previous_page);
  }

The && should be ||

Add possibility to hide first/last page buttons

Hi,

Thanks for this nice package.

It would be very nice if you could add a hideFirstPageLink and hideLastPageLink options to this package - in order to make it possible to chose if you want to display or not these links.

go back to top after page change

So, I have a component getting photos from an API.. I have react-js-pagination working and also added TransitionGroup and CSSTransition to animate the rendering.
But when changing page, there's a gap between the pagination and the photo container, and since the window focus is on the pagination, the animation is not seen and then the gap is closed suddenly.

Is it possible to get the focus back to the top of the page?

Thanks

Not clear how to use it

Hi! Thank you for the plugin. I managed to add the component to the app, though I cannot figure out how to pass the data to show. How does the Pagination component know what items to display? Should I decorate the list of items with it?

Safari [Error] TypeError: Map constructor does not accept arguments

I'm getting the below error only in Safari. When I remove my import of react-js-pagination.js it goes away. It stops my entire site from loading locally in Safari. Anyone else having this issue or know how I can fix this ?

Safari : Version 8.0.8
Mac OSX Yosemite V10.10.5
"webpack": "^2.2.1"

[Error] TypeError: Map constructor does not accept arguments
	Map (undefined, line 1013)
	(anonymous function)
	(anonymous function)
	eval code
	eval ([native code], line 0)
	(anonymous function) (bundle.js, line 6281)
	__webpack_require__ (bundle.js, line 660)........

How to replace navigation button on pagination

Hello,
thank you for your pagination package is very helpful.
i have a question about when i need to change firstPageText it doesn't work the icon is showing but the action click doesn't work this my code :

<Pagination activePage={this.state.activePage}
itemsCountPerPage={10}
firstPageText={
React.createElement('li', {className: ''}, React.createElement("a", {href: '#'}, React.createElement("i", {className: 'material-icons'}, "fast_rewind")))
}
totalItemsCount={100} pageRangeDisplayed={5}
onChange={this.handlePageChange.bind(this)}
/>

thank's in advance.

Hide First Page / Last Page Elements

Loving this so far, the only thing I wish I could do, and maybe I'm over looking something here, is to hide the First Page and Last Page elements and only show the Next Page / Prev Page elements. Is there a way to do so? If not it may be worth exploring. Thanks!

Disable first/prev page instead of hiding

Hi,

I like this simple component, but I'd like to improve the UX by disabling first/prev pagination element instead of hiding it. By doing this, the pagination will not 'jump' and it has more or less a fix width.

This could be of course a configurable thing.

Let me know what you think. I could prepare a MR the next days.

Best,
Raoul

It does not show 1 page when totalItemsCount is smaller than itemsCountPerPage.

For instance,

<Pagination
prevPageText='Prev'
nextPageText='Next'
activePage={props.activePage}
itemsCountPerPage={10}
totalItemsCount={5}
pageRangeDisplayed={props.rangeDisplayed}
onChange={(value) => props.onPage(value)}
/>

In this case, the component has been rendered like the screenshot.

screen shot 2017-05-13 at 2 57 10 am

I think the component should display 1 page number.
Thanks,
Hiroki.

getPageUrl not working

<Pagination
      activePage={actualPage}
      itemsCountPerPage={itemsCountPerPage}
      totalItemsCount={totalItemsCount}
      pageRangeDisplayed={5}
      itemClass='page-item'
      activeLinkClass='page-link active'
      linkClass='page-link'
      onChange={(nextPage) => paginateHandler(searchParams, nextPage)}
      getPageUrl={(i) => `/the-url/${i}`}
    />

this is not returning the url.. a bug? I still get '#'

Add new props to change the class names for first, prev, next and last buttons

Add new 4 props, because it's hard to style first, prev, next and last buttons.

  • linkClassFirst
  • linkClassPrev
  • linkClassNext
  • linkClassLast

Demo example

<ul className={innerClass}>
	<li className={itemClass}><a className=`${linkClass} ${linkClassFirst}`><Icon icon="first" /></a></li>
	<li className={itemClass}><a className=`${linkClass} ${linkClassPrev}`><Icon icon="prev" /></a></li>
	<li className={itemClass}><a className=`${linkClass} ${activeLinkClass}`>1</a></li>
	<li className={itemClass}><a className={linkClass}>2</a></li>
	<li className={itemClass}><a className={linkClass}>3</a></li>
	<li className={itemClass}><a className={linkClass}>4</a></li>
	<li className={itemClass}><a className={linkClass}>5</a></li>
	<li className={itemClass}><a className=`${linkClass} ${linkClassNext}`><Icon icon="next" /></a></li>
	<li className={itemClass}><a className=`${linkClass} ${linkClassLast}`><Icon icon="last" /></a></li>
</ul>

I will try to help with it if I have time over this weekend.

error

ERROR in ./~/react-js-pagination/dist/Pagination.js
Module not found: Error: Cannot resolve module 'className'

Add previousPageClass and nextPageClass

Hi,

I am actually using your library and in my global CSS I have .prev and .next classes for styling navigation items.

But there is no option to specify the previous page and next page classes.

Add activeLinkClass

I'm using bulma to style my project, the project I have is that bulma pagination marks a page as current by adding the is-current tag on the link, which this library can't do.

Would it be possible to add the prop activeLinkClass? Also a boolean prop for disabling the last / prev / first / last buttons would be pretty handy to have ;)

Edit: See bulma docs on pagination here

Allow defining disabled link class

My classes are managed via links, not list item elements, so I would appreciate if additional param disabledlinkClass was available.

E.g. I don't need li class = disabled, but I need a class=disabled.

Module not found

I am getting this error when i am trying to import:

Module not found: You attempted to import ../components/Pagination which falls outside of the project src/ directory. Relative imports outside of src/ are not supported. You can either move it inside src/, or add a symlink to it from project's node_modules/.

A button to navigate to next pagerange

Assume the pageRange property is set to 5 and there are 20 pages. Initially it shows 1,2,3,4,5. There must be a button on clicking of which I should be able to see the next set i.e 6,7,8,9,10 and so on.

Make React dependency less restrictive

I've noticed that the project has a dependency of "react": "^16.0.0".

Is this necessary ? It breaks some apps (like in our case) which are still using old versions of React.

TypeError: this.props.onClick is not a function

In Page.js after event (click) in devtools I see error:
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var a
and handler was implented as onChange={handlePageChange} not as in desription onChange={:: this.handlePageChange}

Maybe I'm doing something wrong.

Bootstrap 4 Compatibility - (Not a huge issue)

First off, I love this component! By my estimation this tool currently only supports Bootstrap 3.x. If you would like it to work for Bootstrap 4, you will need to add 2 additional props when using this component:

itemClass="page-item"
linkClass="page-link"

Accessibility Issues

tabindex not set on link tags by default, unable to focus when using keyboard only

Active Page is not displayed with component refresh upon page change

I've noticed that current pagination library is meant to be used in a scenario when all data fetched once from the server.
The problem is that I fetch data in chunks(only for the current page) and store in a Redux state to reuse later.
So every time I am going to a new page - data is fetched and component with data and pagination are refreshed; when I am returning to the page I've been to before - data is being pulled from the store without component refresh.
So an active page is highlighted only in the last scenario(without component refresh).

Is there any possibility to support this 'active page' state with a component refresh upon page change?

Allow callback for rendering page numbers

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}
        />
      );
    }

Component adds an extra page number

Component adds an extra page number when totalItemsCount does not divide exactly itemsCountPerPage.
For example, if totalItemsCount is 383 and itemsCountPerPage is 10, there should be 39 pages displayed, but component renders 37 pages with 10 items, page 38 contains 3 items and page 39 is empty.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.