FAISP/src/main/resources/static/js/modal/userModal.js

29 lines
806 B
JavaScript

$(document).on('click', '.userInfoTr', function (){
const checkBox = $(this).find(".userInfoCheckBox")[0]
checkBox.checked = !checkBox.checked;
const userSeq = $(this).find(".userSeq").val();
if(checkBox.checked){
selectedList.push({
userSeq: userSeq,
ogCd: $(this).find(".ogCd").val(),
ofcCd: $(this).find(".ofcCd").val(),
titleCd: $(this).find(".titleCd").val(),
userNm: $(this).find(".userNm").val()
})
}else{
const tempList = [];
$.each(selectedList, function (idx, user){
if(user.userSeq !== userSeq){
tempList.push(user);
}
})
selectedList = tempList;
}
})
function setSelectedChkBox(){
$.each(selectedList, function (idx, item){
$(".userInfoCheckBox[value="+item.userSeq+"]").prop("checked", true);
})
}