Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Properly handle a null row / zero rows #5237

Merged
merged 1 commit into from
Oct 28, 2016
Merged
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
5 changes: 3 additions & 2 deletions js/components/sortableTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,14 +363,15 @@ class SortableTable extends React.Component {
? this.getRowAttributes(row, i)
: null

const classes = [rowAttributes.className]
const classes = []
if (rowAttributes) classes.push(rowAttributes.className)
if (this.hasRowClassNames) classes.push(this.props.rowClassNames[i])
if (this.stateOwner.state.selection.includes(this.getGlobalIndex(i))) classes.push('selected')
if (this.sortingDisabled) classes.push('no-sort')

return row.length
? <tr {...rowAttributes}
data-context-menu-disable={rowAttributes.onContextMenu ? true : undefined}
data-context-menu-disable={rowAttributes && rowAttributes.onContextMenu ? true : undefined}
data-table-id={this.tableID}
data-row-index={i}
className={classes.join(' ')}>{entry}</tr>
Expand Down