Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/row select #704

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ The component accepts the following props:
|**`rowsPerPage`**|number|10|Number of rows allowed per page
|**`rowsPerPageOptions`**|array|[10,15,20]|Options to provide in pagination for number of rows a user can select
|**`rowHover`**|boolean|true|Enable/disable hover style over rows
|**`rowSelect`**|boolean|false|Enable/disable select style over rows (mouse pointer / highlight on press)
|**`fixedHeader`**|boolean|true|Enable/disable fixed header columns
|**`sortFilterList`**|boolean|true|Enable/disable alphanumeric sorting of filter lists
|**`sort`**|boolean|true|Enable/disable sort on all columns
Expand Down
2 changes: 2 additions & 0 deletions src/MUIDataTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class MUIDataTable extends React.Component {
onTableInit: PropTypes.func,
caseSensitive: PropTypes.bool,
rowHover: PropTypes.bool,
rowSelect: PropTypes.bool,
fixedHeader: PropTypes.bool,
page: PropTypes.number,
count: PropTypes.number,
Expand Down Expand Up @@ -247,6 +248,7 @@ class MUIDataTable extends React.Component {
caseSensitive: false,
serverSide: false,
rowHover: true,
rowSelect: false,
fixedHeader: true,
elevation: 4,
rowsPerPage: 10,
Expand Down
12 changes: 10 additions & 2 deletions src/components/TableBodyRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@ import { withStyles } from '@material-ui/core/styles';

const defaultBodyRowStyles = theme => ({
root: {},
hover: {},
hover: {
cursor: 'pointer',
'&$root': {
'&:hover:active': {
background: 'rgb(0,106,195, 0.2)',
color: 'white'
}
}
},
hoverCursor: { cursor: 'pointer' },
responsiveStacked: {
[theme.breakpoints.down('sm')]: {
Expand Down Expand Up @@ -37,7 +45,7 @@ class TableBodyRow extends React.Component {
className={classNames(
{
[classes.root]: true,
[classes.hover]: options.rowHover,
[classes.hover]: !!options.rowSelect,
[classes.hoverCursor]: options.selectableRowsOnClick || options.expandableRowsOnClick,
[classes.responsiveStacked]: options.responsive === 'stacked',
},
Expand Down