PropertyTable.js View 수정
This commit is contained in:
@@ -86,9 +86,9 @@ class PropertyTableView {
|
||||
if (checkbox) {
|
||||
checkbox.addEventListener('change', (event) => {
|
||||
const index = parseInt(event.target.parentElement.parentElement.parentElement.getAttribute('data-index'), 10);
|
||||
this.propertyTable.controller.updateProperty(index, 'enabled', event.target.checked);
|
||||
if (this.propertyTable.controller.additionalCallback) {
|
||||
this.propertyTable.controller.additionalCallback(this.model.getProperties());
|
||||
this.controller.updateProperty(index, 'enabled', event.target.checked);
|
||||
if (this.controller.additionalCallback) {
|
||||
this.controller.additionalCallback(this.model.getProperties());
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -103,8 +103,8 @@ class PropertyTableView {
|
||||
editableInput.init(editableElement, (value) => {
|
||||
let model = this.model.getProperties()[index];
|
||||
model[editableElement.dataset.name] = value;
|
||||
if (this.propertyTable.controller.additionalCallback) {
|
||||
this.propertyTable.controller.additionalCallback(this.model.getProperties());
|
||||
if (this.controller.additionalCallback) {
|
||||
this.controller.additionalCallback(this.model.getProperties());
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -121,14 +121,14 @@ class PropertyTableView {
|
||||
console.log(event.target.getAttribute('data-index'));
|
||||
const index = parseInt(event.target.getAttribute('data-index'), 10);
|
||||
console.log({index});
|
||||
this.propertyTable.controller.removeProperty(index);
|
||||
this.controller.removeProperty(index);
|
||||
});
|
||||
});
|
||||
|
||||
const addButton = this.element.querySelector('.add_property');
|
||||
if (addButton) {
|
||||
addButton.addEventListener('click', (event) => {
|
||||
this.propertyTable.controller.addProperty();
|
||||
this.controller.addProperty();
|
||||
});
|
||||
} else {
|
||||
console.log('Add button not found'); // Check if the button is not found
|
||||
@@ -140,7 +140,7 @@ class PropertyTableView {
|
||||
class PropertyTableController {
|
||||
constructor(model) {
|
||||
this.model = model;
|
||||
this.view = new PropertyTableView(this.model);
|
||||
this.view = new PropertyTableView(this.model, this);
|
||||
}
|
||||
|
||||
init(element, callback) {
|
||||
|
||||
Reference in New Issue
Block a user