HM-70 Оживил кнопку удаления апи / изменил способ открытия информации об апи на даблклик (#34)
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
import Component from '../component/index';
|
||||
import ApiInfoComponent from '../api-info-component/index';
|
||||
import TableColumnComponent from '../table-column-component/index';
|
||||
import TableRowComponent from '../table-row-component/TableRowComponent';
|
||||
|
||||
@ -10,7 +9,6 @@ class TableComponent extends Component {
|
||||
this.tableHead = this.mainNode.querySelector('.Table__head');
|
||||
this.tableBody = this.mainNode.querySelector('.Table__body');
|
||||
this.tableHeadRow = this.mainNode.querySelector('.Table__head-row');
|
||||
this.infoBox = new ApiInfoComponent();
|
||||
this.columnArr = [];
|
||||
this.rowArr = [];
|
||||
}
|
||||
@ -34,8 +32,8 @@ class TableComponent extends Component {
|
||||
|
||||
this.array.forEach((item, index) => {
|
||||
const newRow = new TableRowComponent(this.tableBody, item, index);
|
||||
newRow.subscribe('click', () => {
|
||||
this.showInfo(item, index);
|
||||
newRow.subscribe('dblclick', () => {
|
||||
this.next('showInfo', item);
|
||||
});
|
||||
this.rowArr.push(newRow);
|
||||
});
|
||||
@ -45,10 +43,6 @@ class TableComponent extends Component {
|
||||
this.array.sort((a, b) => a[item] > b[item]);
|
||||
this.render(array);
|
||||
}
|
||||
|
||||
showInfo = (object, index) => {
|
||||
this.infoBox.render(object, index);
|
||||
}
|
||||
}
|
||||
|
||||
export default TableComponent;
|
||||
|
||||
Reference in New Issue
Block a user