-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
47 lines (39 loc) · 1 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const KucText = document.createElement("input");
KucText.value = 'kuc input';
const textColumn = {
header: {
text: 'kuc text'
},
cell: KucText
};
const customCell = (cellData) => {
const element = document.createElement('div');
const elementInput1 = document.createElement('input');
elementInput1.value = cellData[0];
element.appendChild(elementInput1);
const elementInput2 = document.createElement('input');
elementInput2.value = cellData[1];
element.appendChild(elementInput2);
return element;
}
const customColumn = {
header: {
text: 'custom column'
},
cell: customCell
};
const table = new window.CustomTable({
columns: [
textColumn,
textColumn,
customColumn
],
data: [
['kuc text 1', 'kuc text 2.1', ['custom 1', 'custom 2']],
['kuc text 2', 'kuc text 2.2', ['custom 1', 'custom 2']],
['kuc text 3', 'kuc text 2.3', ['custom 1', 'custom 2']]
],
});
window.addEventListener('DOMContentLoaded', (event) => {
document.body.appendChild(table);
});