Skip to content

Commit

Permalink
It is now possible to inject a class into a data row.
Browse files Browse the repository at this point in the history
  • Loading branch information
jameswilddev committed Aug 1, 2024
1 parent 9aa312e commit c6819f4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Components/DataRow.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import classNames from 'classnames'

class DataRow extends Component {
static noop () {
Expand All @@ -13,15 +14,15 @@ class DataRow extends Component {
}

render () {
const { row, fields, onClick, onMouseUp, onMouseDown, onContextMenu, rowIsActive } = this.props
const { row, fields, onClick, onMouseUp, onMouseDown, onContextMenu, rowIsActive, className } = this.props

return (
<tr
onClick={e => onClick(e, row)}
onMouseUp={e => onMouseUp(e, row)}
onMouseDown={e => onMouseDown(e, row)}
onContextMenu={e => onContextMenu(e, row)}
className={rowIsActive(row) ? 'table-active' : null}
className={classNames(className, { 'table-active': rowIsActive(row) })}
>
{this.renderCheckboxCell()}
{fields.map(field => this.renderCell(field, row))}
Expand Down Expand Up @@ -234,7 +235,8 @@ DataRow.propTypes = {
index: PropTypes.number.isRequired,
fields: PropTypes.array,
rowIsActive: PropTypes.bool,
disableCheckbox: PropTypes.bool
disableCheckbox: PropTypes.bool,
className: PropTypes.string
}

export default DataRow

0 comments on commit c6819f4

Please sign in to comment.