Fix: disable unused input, buttons

This commit is contained in:
2018-07-03 18:25:04 +09:00
parent cec8e18470
commit 3f97b1eac3
4 changed files with 53 additions and 42 deletions
+17 -6
View File
@@ -15,7 +15,7 @@ class PlayerList {
constructor(parent) {
let self = this;
this.listParent = parent;
// console.log(parent);
console.log(parent);
let id_list = parent.find(".player_id");
// console.log(id_list);
@@ -30,6 +30,8 @@ class PlayerList {
$(id_list[i]).siblings(".player_delete")
);
this.disableItem(this.listRows[i]);
$(id_list[i]).siblings(".player_edit").click(function() {
self.editPlayer(this);
})
@@ -42,11 +44,20 @@ class PlayerList {
}
}
disableItem(item) {
$(item.playerID).empty();
$(item.playerName).prop("disabled", true);
$(item.enterCode).prop("disabled", true);
$(item.editButton).prop("disabled", true);
$(item.deleteButton).prop("disabled", true);
}
updatePlayerList(jsonData) {
// console.log(jsonData);
for(let i = 0; i < 10; i++) {
$(this.listRows[i].playerID).empty();
// $(this.listRows[i].playerID).empty();
this.disableItem(this.listRows[i]);
if(i < jsonData.length) {
$(this.listRows[i].playerID).append(jsonData[i]["UserID"]);
@@ -61,13 +72,13 @@ class PlayerList {
$(this.listRows[i].deleteButton).prop("disabled", false);
} else {
$(this.listRows[i].playerName).val("");
$(this.listRows[i].playerName).prop("disabled", true);
// $(this.listRows[i].playerName).prop("disabled", true);
$(this.listRows[i].enterCode).val("");
$(this.listRows[i].enterCode).prop("disabled", true);
// $(this.listRows[i].enterCode).prop("disabled", true);
$(this.listRows[i].editButton).prop("disabled", true);
$(this.listRows[i].deleteButton).prop("disabled", true);
// $(this.listRows[i].editButton).prop("disabled", true);
// $(this.listRows[i].deleteButton).prop("disabled", true);
}
}
}