25
src/components/table-row-component/TableRowComponent.js
Normal file
25
src/components/table-row-component/TableRowComponent.js
Normal file
@ -0,0 +1,25 @@
|
||||
import Component from '../component/index';
|
||||
|
||||
class TableRowComponent extends Component {
|
||||
constructor (container, object, index) {
|
||||
super('#table-row', container);
|
||||
|
||||
this.row = this.mainNode;
|
||||
this.indexPlace = this.mainNode.querySelector('.Body__row-index');
|
||||
this.content = Object.values(object);
|
||||
this.indexPlace.textContent = index + 1;
|
||||
|
||||
this.content.forEach((text) => {
|
||||
const contentPlace = document.createElement('td');
|
||||
contentPlace.textContent = typeof(text) !== 'string' ? typeof(text) : text;
|
||||
this.row.appendChild(contentPlace);
|
||||
});
|
||||
|
||||
this.addEventListener(this.mainNode, 'click', (evt) => {
|
||||
this.next('click', evt);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
export default TableRowComponent;
|
||||
Reference in New Issue
Block a user