React-table: Checkbox table

Created on 22 Jun 2017  路  5Comments  路  Source: tannerlinsley/react-table

Problem Description

I am trying to use the react-table as a checkbox table. That is, the first column will be checkboxes, which in turn should select the row. I am able to select the checkboxes in my application, but once I sort it, the checkbox column do not get sorted. Also for some reason in the pen, the checkboxes are not coming up correctly.

I feel there might be a better way to implement this. Is there a better way to implement a Checkbox table using react-table?

Code Snippet(s) or Codepen (http://codepen.io/tannerlinsley/pen/QpeZBa?editors=0010)

https://codepen.io/poushy/pen/jwwyxQ

Steps to Reproduce

  1. Bring up the table with checkboxes
  2. Click on one or two row checkboxes
    3.Sort the table
  3. Even though rest of the table gets sorted, the checkboxes do not get sorted. That is, if I select row1, and row3, then sort and row1 and row3 goes to the bottom, the selected checkboxes remain at the same row.
    Expected: The rows that are selected should be sorted correctly, i.e. row1 and row3 should be selected.

Most helpful comment

All 5 comments

Thank you @aaronschwartz - I will try this out!

@aaronschwartz I have the same question. In your example, I want have a checkbox in the header, if the user clicked it. All checkbox in the rows will be checked. I been working on this for a while...

@hijoncon See updated pen.

I'd really appreciated it! @aaronschwartz thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dwjft picture dwjft  路  3Comments

dilipsundarraj1 picture dilipsundarraj1  路  3Comments

mlajszczak picture mlajszczak  路  3Comments

DaveyEdwards picture DaveyEdwards  路  3Comments

esetnik picture esetnik  路  3Comments