Implement actual swapping on drag and drop
This commit is contained in:
parent
88408b7543
commit
11d607c08b
|
|
@ -128,7 +128,18 @@ export default class EditableStringList extends React.Component {
|
|||
}
|
||||
|
||||
onGroupSwitch(src, dest) {
|
||||
console.log('Switched src (' + JSON.stringify(src) + ') to dest (' + JSON.stringify(dest) + ')' );
|
||||
const groupCopy = this.state.groups.slice();
|
||||
|
||||
const srcTeam = groupCopy[src.group][src.team];
|
||||
const destTeam = groupCopy[dest.group][dest.team];
|
||||
|
||||
groupCopy[src.group].splice(src.team, 1, destTeam);
|
||||
groupCopy[dest.group].splice(dest.team, 1, srcTeam);
|
||||
|
||||
this.setState({
|
||||
groups: groupCopy
|
||||
});
|
||||
this.props.onGroupsChange(this.state.groups);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue