|
@ -152,11 +152,8 @@ let AntTable = React.createClass({ |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
handleSelect(record, rowIndex, e) { |
|
|
handleSelect(record, rowIndex, e) { |
|
|
let checked = e.target.checked; |
|
|
const checked = e.target.checked; |
|
|
let defaultSelection = []; |
|
|
const defaultSelection = this.state.selectionDirty ? [] : this.getDefaultSelection(); |
|
|
if (!this.state.selectionDirty) { |
|
|
|
|
|
defaultSelection = this.getDefaultSelection(); |
|
|
|
|
|
} |
|
|
|
|
|
let selectedRowKeys = this.state.selectedRowKeys.concat(defaultSelection); |
|
|
let selectedRowKeys = this.state.selectedRowKeys.concat(defaultSelection); |
|
|
let key = this.getRecordKey(record, rowIndex); |
|
|
let key = this.getRecordKey(record, rowIndex); |
|
|
if (checked) { |
|
|
if (checked) { |
|
@ -180,11 +177,8 @@ let AntTable = React.createClass({ |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
handleRadioSelect: function (record, rowIndex, e) { |
|
|
handleRadioSelect: function (record, rowIndex, e) { |
|
|
let checked = e.target.checked; |
|
|
const checked = e.target.checked; |
|
|
let defaultSelection = []; |
|
|
const defaultSelection = this.state.selectionDirty ? [] : this.getDefaultSelection(); |
|
|
if (!this.state.selectionDirty) { |
|
|
|
|
|
defaultSelection = this.getDefaultSelection(); |
|
|
|
|
|
} |
|
|
|
|
|
let selectedRowKeys = this.state.selectedRowKeys.concat(defaultSelection); |
|
|
let selectedRowKeys = this.state.selectedRowKeys.concat(defaultSelection); |
|
|
let key = this.getRecordKey(record, rowIndex); |
|
|
let key = this.getRecordKey(record, rowIndex); |
|
|
selectedRowKeys = [key]; |
|
|
selectedRowKeys = [key]; |
|
@ -203,18 +197,29 @@ let AntTable = React.createClass({ |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
handleSelectAllRow(e) { |
|
|
handleSelectAllRow(e) { |
|
|
let checked = e.target.checked; |
|
|
const checked = e.target.checked; |
|
|
let data = this.getCurrentPageData(); |
|
|
const data = this.getCurrentPageData(); |
|
|
let selectedRowKeys = checked ? data.filter((item) => { |
|
|
const defaultSelection = this.state.selectionDirty ? [] : this.getDefaultSelection(); |
|
|
if (this.props.rowSelection.getCheckboxProps) { |
|
|
const selectedRowKeys = this.state.selectedRowKeys.concat(defaultSelection); |
|
|
return !this.props.rowSelection.getCheckboxProps(item).disabled; |
|
|
const changableRowKeys = data.filter(item => |
|
|
|
|
|
!this.props.rowSelection.getCheckboxProps || |
|
|
|
|
|
!this.props.rowSelection.getCheckboxProps(item).disabled |
|
|
|
|
|
).map((item, i) => this.getRecordKey(item, i)); |
|
|
|
|
|
if (checked) { |
|
|
|
|
|
changableRowKeys.forEach(key => { |
|
|
|
|
|
if (selectedRowKeys.indexOf(key) < 0) { |
|
|
|
|
|
selectedRowKeys.push(key); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} else { |
|
|
|
|
|
changableRowKeys.forEach(key => { |
|
|
|
|
|
if (selectedRowKeys.indexOf(key) >= 0) { |
|
|
|
|
|
selectedRowKeys.splice(selectedRowKeys.indexOf(key), 1); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
return true; |
|
|
|
|
|
}).map((item, i) => { |
|
|
|
|
|
return this.getRecordKey(item, i); |
|
|
|
|
|
}) : []; |
|
|
|
|
|
this.setState({ |
|
|
this.setState({ |
|
|
selectedRowKeys: selectedRowKeys, |
|
|
selectedRowKeys, |
|
|
selectionDirty: true |
|
|
selectionDirty: true |
|
|
}); |
|
|
}); |
|
|
if (this.props.rowSelection.onSelectAll) { |
|
|
if (this.props.rowSelection.onSelectAll) { |
|
|