Search code examples
reactjssemantic-ui-react

Does Semantic-UI-React's table component support a function similar to OnRowSelect?


I have code that looks similar to this:

<Table selectable>
  <Table.Header>
    <Table.HeaderCell />
    <Table.HeaderCell>ID</Table.HeaderCell>
    <Table.HeaderCell>Name</Table.HeaderCell>
  </Table.Header>
  <Table.Body>
    <Table.Row>
      <Table.Cell>
        <Table.Cell><Checkbox /></Table.Cell>
      </Table.Cell>
      <Table.Cell>1</Table.Cell>
      <Table.Cell>George</Table.Cell>
    <Table.Row>
  </Table.Body>
</Table>

I would like to be able to use the checkbox as a handle to dispatch actions like edit, remove, etc. I know that the Table component supports a selectable prop, however all it seems to do is make a row appear selectable. I can't seem to find any functionality that passes back the selected row as an argument in a function similar to onRowSelect.


Solution

  • selectable prop only adds CSS class, there are no real functionality under hood at now. You should implement onClick yourself.