forked from SavanAghera/js-review-project-2024
-
Notifications
You must be signed in to change notification settings - Fork 0
/
baseTable.js
30 lines (27 loc) · 848 Bytes
/
baseTable.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
class BaseTable extends BaseClass{
render() {
super.render(this.componentRenderer)
}
componentRenderer() {
const table = document.createElement('table');
this.getRenderData().forEach(data => {
const tr = document.createElement('tr');
this.renderCells(tr, this.getCellData(data))
table.append(tr)
});
return table;
}
getRenderData() {
}
getCellData(data) {
}
renderCells(element , cellData) {
// do not edit this function is possible
cellData.forEach(data => {
const childElement = document.createElement(data.elementName);
childElement.textContent = data.text;
childElement.onclick = data.handleClick
element.append(childElement);
})
}
}