[Feature]单选表格,行选中后再次点击可取消选中
This commit is contained in:
parent
8dd48af754
commit
558264ea73
|
@ -42,8 +42,15 @@ function singleSelect(Table, Radio) {
|
||||||
var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
var _this = _possibleConstructorReturn(this, _Component.call(this, props));
|
||||||
|
|
||||||
_this.onRadioChange = function (value, record, index) {
|
_this.onRadioChange = function (value, record, index) {
|
||||||
|
var selectedRowIndex = _this.state.selectedRowIndex;
|
||||||
|
|
||||||
|
if (selectedRowIndex === index) {
|
||||||
|
_this.setState({ selectedRowIndex: '' });
|
||||||
|
_this.props.getSelectedDataFunc();
|
||||||
|
} else {
|
||||||
_this.setState({ selectedRowIndex: index });
|
_this.setState({ selectedRowIndex: index });
|
||||||
_this.props.getSelectedDataFunc(record, index);
|
_this.props.getSelectedDataFunc(record, index);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_this.getDefaultColumns = function (columns) {
|
_this.getDefaultColumns = function (columns) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -56,7 +56,7 @@
|
||||||
"bee-loading": "1.1.2",
|
"bee-loading": "1.1.2",
|
||||||
"bee-locale": "0.0.14",
|
"bee-locale": "0.0.14",
|
||||||
"bee-menus": "^2.0.6",
|
"bee-menus": "^2.0.6",
|
||||||
"bee-radio": "2.0.10",
|
"bee-radio": "^2.0.11",
|
||||||
"bee-select": "^2.0.11",
|
"bee-select": "^2.0.11",
|
||||||
"classnames": "^2.2.5",
|
"classnames": "^2.2.5",
|
||||||
"component-classes": "^1.2.6",
|
"component-classes": "^1.2.6",
|
||||||
|
|
|
@ -45,9 +45,15 @@ export default function singleSelect(Table, Radio) {
|
||||||
}
|
}
|
||||||
|
|
||||||
onRadioChange = (value, record, index) => {
|
onRadioChange = (value, record, index) => {
|
||||||
|
let { selectedRowIndex } = this.state;
|
||||||
|
if(selectedRowIndex === index){
|
||||||
|
this.setState({selectedRowIndex: ''});
|
||||||
|
this.props.getSelectedDataFunc();
|
||||||
|
}else{
|
||||||
this.setState({selectedRowIndex: index});
|
this.setState({selectedRowIndex: index});
|
||||||
this.props.getSelectedDataFunc(record,index);
|
this.props.getSelectedDataFunc(record,index);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
getDefaultColumns=(columns)=>{
|
getDefaultColumns=(columns)=>{
|
||||||
let {selectedRowIndex} = this.state;
|
let {selectedRowIndex} = this.state;
|
||||||
|
|
Loading…
Reference in New Issue