-
Notifications
You must be signed in to change notification settings - Fork 12
Adding pagination to disputes grid #93
Conversation
# Conflicts: # src/Components/DisputesTable/GridContent/index.js
Changed code to meet ESLint issues. Added a test to not decrease overall coverage.
currentPage: 1 | ||
} | ||
this.paginateHandler = this.paginateHandler.bind(this) | ||
this.paginateInputHandler = this.paginateInputHandler.bind(this) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you don't need bind()
see https://medium.com/shoutem/react-to-bind-or-not-to-bind-7bf58327e22a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inside those method I'm settings this.state. If I don't bind then I won't have this available (would be undefined). Please let me know if you consider a workaround.
componentWillMount () { | ||
this.props.getDataDisputes() | ||
} | ||
|
||
paginateHandler (event) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could use the functional syntax for your own function like paginateHandler = e => (this.setState({ currentPage: Number(e.target.dataset.pageNumber) }))
this.setState({ | ||
currentPage: Number(event.target.value) | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idems
}) | ||
const currentRows = list.slice(indexOfFirstRow, indexOfLastRow) | ||
|
||
const totalPages = Math.ceil(list.length / rowsPerPage) || 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you create a function like const currentRows = (list, indexOfLastRow, indexOfFirstRow)
in the utils
folder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find a utils folder. Perhaps you meant "helpers" ?
and can you hide the "paginator" if there are not enough disputes |
Pagination now shows only if there is more than 1 page. Added story to storybook showing dispute table with no pagination. Styled the paginator a bit to make it look more like the theme. Added test on the grid not showing pagination.
@n1c01a5 Fixed most of the stuff you requested.
|
@eburgos yes it's the |
Refers to #62
Disputes grid with pagination. I hope it helps.
Regards,