question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

checkboxHOC toggling checkbox resets pagination

See original GitHub issue

What 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:closed
  • Created 6 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
patfratcommented, Mar 22, 2018

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 !

0reactions
ribosradagastcommented, May 4, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found