PropertyTable.js View 수정

This commit is contained in:
현성필
2024-02-19 15:17:10 +09:00
parent 778b36d512
commit a77c7a6965
2 changed files with 11 additions and 8 deletions
@@ -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) {
@@ -18,6 +18,9 @@ public class ApiRequestKeyValueDTO implements Serializable {
this.value = value;
}
public ApiRequestKeyValueDTO() {
}
public boolean isEnabled() {
return enabled;
}