mirror of
https://github.com/gosticks/react-table.git
synced 2026-08-15 14:30:27 +00:00
Adding IDs for select table, fixing backwards compatibility on floating left checkbox (#1208)
* Adding IDs for select all and individual row checkboxes * Using keyfield const
This commit is contained in:
committed by
Tanner Linsley
parent
e0f9d98819
commit
de6389cafc
Generated
+1518
-1482
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,7 @@ const defaultSelectInputComponent = props => {
|
||||
type={props.selectType || 'checkbox'}
|
||||
aria-label={`${props.checked ? 'Un-select':'Select'} row with id:${props.id}` }
|
||||
checked={props.checked}
|
||||
id={props.id}
|
||||
onClick={e => {
|
||||
const { shiftKey } = e
|
||||
e.stopPropagation()
|
||||
@@ -32,8 +33,8 @@ export default (Component, options) => {
|
||||
checked,
|
||||
onClick: toggleSelection,
|
||||
selectType,
|
||||
id: row[keyField],
|
||||
row,
|
||||
id: `select-${row[keyField]}`
|
||||
}
|
||||
return React.createElement(this.props.SelectInputComponent, inputProps)
|
||||
}
|
||||
@@ -47,6 +48,7 @@ export default (Component, options) => {
|
||||
checked,
|
||||
onClick: toggleAll,
|
||||
selectType,
|
||||
id: 'select-all'
|
||||
}
|
||||
|
||||
return React.createElement(SelectAllInputComponent, inputProps)
|
||||
@@ -73,7 +75,6 @@ export default (Component, options) => {
|
||||
SelectInputComponent,
|
||||
...rest
|
||||
} = this.props
|
||||
const { floatingLeft = false } = options
|
||||
const select = {
|
||||
id: '_selector',
|
||||
accessor: () => 'x', // this value is not important
|
||||
@@ -88,7 +89,7 @@ export default (Component, options) => {
|
||||
style: { textAlign: 'center' },
|
||||
}
|
||||
|
||||
const columns = floatingLeft ? [...originalCols, select] : [select, ...originalCols]
|
||||
const columns = (options !== undefined && options.floatingLeft === true) ? [...originalCols, select] : [select, ...originalCols]
|
||||
const extra = {
|
||||
columns,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user