Handsontable example
HTML
<script src="https://cdn.jsdelivr.net/npm/handsontable@10.0/dist/handsontable.full.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/handsontable@10.0/dist/handsontable.full.min.css" />
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@handsontable/vue@10.0/dist/vue-handsontable.min.js"></script>
<script src="https://handsontable.com/docs/scripts/fixer.js"></script>
<div id="example1">
<hot-table :settings="hotSettings"></hot-table>
</div>
Babel + JSX
import Vue from 'vue';
import { HotTable } from '@handsontable/vue';
import Handsontable from 'handsontable';
class CustomEditor extends Handsontable.editors.TextEditor {
constructor(props) {
super(props);
}
createElements() {
super.createElements();
this.TEXTAREA = document.createElement('input');
this.TEXTAREA.maxLength = 4;
this.TEXTAREA.setAttribute('placeholder', 'Custom placeholder');
this.TEXTAREA.setAttribute('data-hot-input', true);
this.textareaStyle = this.TEXTAREA.style;
Handsontable.dom.empty(this.TEXTAREA_PARENT);
this.TEXTAREA_PARENT.appendChild(this.TEXTAREA);
}
}
new Vue({
el: '#example1',
data() {
return {
hotSettings: {
startRows: 5,
columns: [
{
editor: CustomEditor
}
],
colHeaders: true,
colWidths: 200,
licenseKey: 'non-commercial-and-evaluation'
}
}
},
components: {
HotTable
}
});