Closed nidhik157 closed 5 months ago
@cscan FYI. This happens when I click on the add button for adding a new column
Currently no simple method provided to add or delete columns. However, I have codes in adding new column by recreating the fields variable. Let me look around ....
You may try the register hook:
<vue-excel-editor ref="editor" v-model="table" :register="regColumn" />
data () {
return {
table: []
}
}
methods: {
doImport () {
this.$refs.editor.reset()
this.table = [
{columnA: 1, columnB: 992},
{columnA: 2, columnB: 993},
{columnA: 3, columnB: 994},
{columnA: 4, columnB: 999}
],
},
regColumn (field, pos) {
if (field.name === 'columnA') {
field.header = 'Column A'
field.width = '100px'
field.dataType = 'NUMBER'
}
if (field.name === 'columnB') {
field.header = 'Column B'
field.width = '200px'
field.dataType = 'NUMBER'
}
}
}