코드관리 삭제버튼 오류수정
parent
81f0d616a1
commit
02e620ffeb
|
|
@ -44,7 +44,9 @@ $(document).on('click', '.rowDeleteBtn', function (){
|
||||||
switch ($(this).parents("table")[0].id){
|
switch ($(this).parents("table")[0].id){
|
||||||
case "categoryTable":
|
case "categoryTable":
|
||||||
selectedCategoryIdx = $(this).parents('tr')[0].rowIndex-1;
|
selectedCategoryIdx = $(this).parents('tr')[0].rowIndex-1;
|
||||||
codeCategoryList.splice(selectedItemIdx, 1);
|
codeCategoryList.splice(selectedCategoryIdx, 1);
|
||||||
|
$("#emptyTr").show();
|
||||||
|
$("#itemBtnRow").hide();
|
||||||
break;
|
break;
|
||||||
case "itemTable":
|
case "itemTable":
|
||||||
selectedItemIdx = $(this).parents('tr')[0].rowIndex-1;
|
selectedItemIdx = $(this).parents('tr')[0].rowIndex-1;
|
||||||
|
|
@ -54,14 +56,19 @@ $(document).on('click', '.rowDeleteBtn', function (){
|
||||||
$(this).parents('tr').remove();
|
$(this).parents('tr').remove();
|
||||||
})
|
})
|
||||||
|
|
||||||
$(document).on('click', '.categoryTr', function (){
|
$(document).on('click', '.categoryTr', function (event){
|
||||||
selectedCategoryIdx = this.rowIndex-1;
|
$("#itemTable").find("tbody").find("tr").remove();
|
||||||
$(".allChk").prop("checked", false);
|
if(event.target.classList.value === "bi bi-x"
|
||||||
$('#itemTable').find('tbody').find('tr').remove();
|
|| event.target.classList.value.includes("rowDeleteBtn")) {
|
||||||
$("#itemBtnRow").show();
|
}else{
|
||||||
|
selectedCategoryIdx = this.rowIndex-1;
|
||||||
|
$("#itemBtnRow").show();
|
||||||
|
$("#emptyTr").hide();
|
||||||
|
|
||||||
if(codeCategoryList[selectedCategoryIdx].itemList.length>0){
|
if(codeCategoryList[selectedCategoryIdx]!==undefined
|
||||||
makeItemTr(codeCategoryList[selectedCategoryIdx].itemList);
|
&& codeCategoryList[selectedCategoryIdx].itemList.length>0){
|
||||||
|
makeItemTr(codeCategoryList[selectedCategoryIdx].itemList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -139,7 +146,7 @@ function makeItemTr(itemList){
|
||||||
itemList.forEach(function (item, idx){
|
itemList.forEach(function (item, idx){
|
||||||
$("#itemTable").find('tbody').append(
|
$("#itemTable").find('tbody').append(
|
||||||
'<tr class="itemTr" '+(item.status==="delete"?'style="display:none;"':'')+'>' +
|
'<tr class="itemTr" '+(item.status==="delete"?'style="display:none;"':'')+'>' +
|
||||||
'<td>'+(item.status==="new"?'<button class="btn btn-sm btn-outline-danger rowDeleteBtn"><i class="bi bi-x"></i></button>':'<input type="checkbox" class="codeItemChk">')+'</td>'+
|
'<td>'+(item.status==="new"?'<button class="btn btn-sm btn-outline-danger rowDeleteBtn"><i class="bi bi-x"></i></button>':'')+'</td>'+
|
||||||
'<td><input type="text" class="form-control form-control-sm itemInput" name="itemCd" value="'+item.itemCd+'"></td>'+
|
'<td><input type="text" class="form-control form-control-sm itemInput" name="itemCd" value="'+item.itemCd+'"></td>'+
|
||||||
'<td><input type="text" class="form-control form-control-sm itemInput" name="itemValue" value="'+item.itemValue+'"></td>'+
|
'<td><input type="text" class="form-control form-control-sm itemInput" name="itemValue" value="'+item.itemValue+'"></td>'+
|
||||||
'<td><input type="checkbox" class="itemInput" name="useChk" '+(item.useChk==="T"?'checked':'')+'></td>'+
|
'<td><input type="checkbox" class="itemInput" name="useChk" '+(item.useChk==="T"?'checked':'')+'></td>'+
|
||||||
|
|
|
||||||
|
|
@ -59,8 +59,11 @@
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="overflow-scroll">
|
<tbody class="overflow-scroll">
|
||||||
<tr><td colspan="4">분류를 선택해주세요.</td></tr>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr id="emptyTr"><td colspan="4">분류를 선택해주세요.</td></tr>
|
||||||
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="row justify-content-center" id="itemBtnRow" style="display: none">
|
<div class="row justify-content-center" id="itemBtnRow" style="display: none">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue