checkboxHOC toggling checkbox resets pagination
See original GitHub issueWhat version of React-Table are you using?
6.7.6
What bug are you experiencing, or what feature are you proposing?
BUG checkboxHOC toggling checkbox resets pagination
Code
based on https://react-table.js.org/#/story/select-table-hoc
<CheckboxTable
data={collection}
defaultFilterMethod={filterCaseInsensitive}
// eslint-disable-next-line no-return-assign
ref={(r) => this.checkboxTable = r}
columns={columns}
defaultPageSize={10}
className="-striped -highlight pointer-on-hover"
loading={loading}
filterable
resizable
keyField={'id'}
{...checkboxProps}
/>
What are the steps to reproduce the issue?
Selecting/toggling a checkbox resets the pagination, i.e. it resets the page displayed back to 1.
This happens somewhere in/after the onClick of defaultSelectInputComponent
onClick: function onClick(e) {
var shiftKey = e.shiftKey;
e.stopPropagation();
props.onClick(props.id, shiftKey, props.row);
},
Somehow this does not happen in your example but I can not, for the life of me, figure out what this is causing. Can this be caused by the data loading async?
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
checkboxHOC toggling checkbox resets pagination · Issue #767
Selecting/toggling a checkbox resets the pagination, i.e. it resets the page displayed back to 1. This happens somewhere in/after the onClick of ...
Read more >Pagination resets checkbox of rows - Stack Overflow
1 Answer 1 · Write your own pagination tag that wraps g.paginate and modifies which params are sent so that your checkbox values...
Read more >Checkbox getting unchecked during pagination in Visualforce
For a simple checkbox, you could accomplish this by using a Set<Id> to track Ids of "selected" records. public class MyExtension{ public ...
Read more >Developers - checkboxHOC toggling checkbox resets pagination -
Selecting/toggling a checkbox resets the pagination, i.e. it resets the page displayed back to 1. This happens somewhere in/after the onClick of ...
Read more >Unable to persist checkbox in a table with pagination. : r/angular
I have tried logging selected list between the changes and it does not loose its values .Even the function checkbox returns true for...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello ! I know this issue is closed but i have encountered the same issue when sorting then clicking on checkboxes. It was just a mistake that i made adding const CheckboxTable = checkboxHOC(ReactTable); in the render method of my component ! Removing this outside my class after import and it works !
That was it, thanks!
In my case, the whole table was resetting when it was sorted and then you clicked a checkbox and altered class state to record it. Moving the CheckboxTable declaration above the class declaration fixed it.