diff --git a/src/main/resources/static/js/codeMgt/codeMgt.js b/src/main/resources/static/js/codeMgt/codeMgt.js index 42ce179b..634971be 100644 --- a/src/main/resources/static/js/codeMgt/codeMgt.js +++ b/src/main/resources/static/js/codeMgt/codeMgt.js @@ -44,7 +44,9 @@ $(document).on('click', '.rowDeleteBtn', function (){ switch ($(this).parents("table")[0].id){ case "categoryTable": selectedCategoryIdx = $(this).parents('tr')[0].rowIndex-1; - codeCategoryList.splice(selectedItemIdx, 1); + codeCategoryList.splice(selectedCategoryIdx, 1); + $("#emptyTr").show(); + $("#itemBtnRow").hide(); break; case "itemTable": selectedItemIdx = $(this).parents('tr')[0].rowIndex-1; @@ -54,14 +56,19 @@ $(document).on('click', '.rowDeleteBtn', function (){ $(this).parents('tr').remove(); }) -$(document).on('click', '.categoryTr', function (){ - selectedCategoryIdx = this.rowIndex-1; - $(".allChk").prop("checked", false); - $('#itemTable').find('tbody').find('tr').remove(); - $("#itemBtnRow").show(); +$(document).on('click', '.categoryTr', function (event){ + $("#itemTable").find("tbody").find("tr").remove(); + if(event.target.classList.value === "bi bi-x" + || event.target.classList.value.includes("rowDeleteBtn")) { + }else{ + selectedCategoryIdx = this.rowIndex-1; + $("#itemBtnRow").show(); + $("#emptyTr").hide(); - if(codeCategoryList[selectedCategoryIdx].itemList.length>0){ - makeItemTr(codeCategoryList[selectedCategoryIdx].itemList); + if(codeCategoryList[selectedCategoryIdx]!==undefined + && codeCategoryList[selectedCategoryIdx].itemList.length>0){ + makeItemTr(codeCategoryList[selectedCategoryIdx].itemList); + } } }) @@ -139,7 +146,7 @@ function makeItemTr(itemList){ itemList.forEach(function (item, idx){ $("#itemTable").find('tbody').append( '' + - ''+(item.status==="new"?'':'')+''+ + ''+(item.status==="new"?'':'')+''+ ''+ ''+ ''+ diff --git a/src/main/resources/templates/adminPage/codeMgt/codeMgt.html b/src/main/resources/templates/adminPage/codeMgt/codeMgt.html index 97af015f..3fba41a6 100644 --- a/src/main/resources/templates/adminPage/codeMgt/codeMgt.html +++ b/src/main/resources/templates/adminPage/codeMgt/codeMgt.html @@ -59,8 +59,11 @@ - 분류를 선택해주세요. + + + 분류를 선택해주세요. +