UNPKG

@bigfishtv/cockpit

Version:

24 lines (20 loc) 621 B
import React, { Component } from 'react' import { Cell } from 'fixed-data-table' import Checkbox from '../../input/Checkbox' /** * Table cell for displaying a boolean value */ export default class FixedDataTableCheckboxSelectCell extends Component { render() { const { data, rowIndex, columnKey, selectedIds, onSelect, ...props } = this.props const id = data[rowIndex]['id'] const selected = selectedIds.indexOf(id) >= 0 return ( <Cell {...props}> <div className="table-checkbox-wrapper"> <Checkbox value={selected} onChange={value => onSelect(data[rowIndex])} /> </div> </Cell> ) } }