| | |
| | | |
| | | enterPress = () => { |
| | | const { col, record } = this.props |
| | | const { value } = this.state |
| | | |
| | | this.setState({editing: false}) |
| | | if (col.enter === '$next') { |
| | | MKEmitter.emit('nextLine', col, record.$Index) |
| | | } else { |
| | | MKEmitter.emit('tdFocus', col.enter + record.$Index) |
| | | } |
| | | |
| | | let _record = {...record, [col.field]: value} |
| | | MKEmitter.emit('changeRecord', _record) |
| | | } |
| | | |
| | | focus = () => { |
| | |
| | | } |
| | | |
| | | onBlur = () => { |
| | | const { col, record } = this.props |
| | | const { value } = this.state |
| | | |
| | | this.setState({editing: false}) |
| | | |
| | | let _record = {...record, [col.field]: value} |
| | | MKEmitter.emit('changeRecord', _record) |
| | | } |
| | | |
| | | render() { |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { setting, fields, columns } = this.props |
| | | const { setting, fields, columns, data } = this.props |
| | | let orderfields = {} |
| | | let initEditLine = null |
| | | |
| | |
| | | } |
| | | |
| | | this.setState({ |
| | | data, |
| | | columns: _columns, |
| | | tableId, |
| | | orderfields, |
| | |
| | | componentDidMount () { |
| | | MKEmitter.addListener('resetTable', this.resetTable) |
| | | MKEmitter.addListener('nextLine', this.nextLine) |
| | | MKEmitter.addListener('changeRecord', this.changeRecord) |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | MKEmitter.removeListener('resetTable', this.resetTable) |
| | | MKEmitter.removeListener('nextLine', this.nextLine) |
| | | MKEmitter.removeListener('changeRecord', this.changeRecord) |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | |
| | | } |
| | | } |
| | | |
| | | changeRecord = (record) => { |
| | | let _data = this.state.data.map(item => { |
| | | if (item.$Index === record.$Index) { |
| | | return record |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | |
| | | this.setState({data: _data}) |
| | | } |
| | | |
| | | changeTable = (pagination, filters, sorter) => { |
| | | const { orderfields } = this.state |
| | | |