| | |
| | | } |
| | | |
| | | onColumnNameChange = () => { |
| | | const { showColumnName } = this.state |
| | | const { showColumnName, config } = this.state |
| | | |
| | | if (!showColumnName) { |
| | | let fields = [] |
| | | config.columns.forEach(col => { |
| | | if (col.field) { |
| | | fields.push(col.field) |
| | | } |
| | | }) |
| | | |
| | | fields = fields.join(',') |
| | | |
| | | let textArea = document.createElement('textarea') |
| | | textArea.value = fields |
| | | document.body.appendChild(textArea) |
| | | textArea.select() |
| | | |
| | | try { |
| | | document.execCommand('copy') |
| | | document.body.removeChild(textArea) |
| | | } catch (err) { |
| | | document.body.removeChild(textArea) |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | showColumnName: !showColumnName |