앱)select box 선택시에 팝업이 뜨는 로직정리
<c:choose>
<c:when test="">
<select id="selStatusCd${lineIndex.index}" onchange="changeStatusCode('${id}', '${status}', 'selStatusCd${lineIndex.index}');" onfocus="beforeStatusCode(this);">
<option value="">${statuscode}</option>
<option value="R" <c:if test="${statusCode == 'R'}">selected="selected"</c:if>>Ready</option>
</select>
</c:when>
</c:choose>
var changeParams, beforeValue, beforeSelId;
function beforeStatusCode(obj){
beforeValue = obj.value;
}
function unchangedStatusCode() {
$("#"+beforeSelId).val(beforeValue);
}
function changeStatusCode(id, previousStatus, selId){
changeParams = {
'id' : id,
'previousStatus' : previousStatus,
'statusCode' : $("#"+selId).val()
};
beforeSelId = selId;
var msg = 'Do you confirm to chage the [' + id + '] status ?';
$('#messageValue1").text(msg);
$.dimPopup.init();
$.dimPopup.layerOpen("#confirm_popup);
}
function doChnageStatusCode() {
$.ajax({
url : "<c:url value='/xxx.do' />",
type: 'post',
data : changeParams,
beforeSend : function(xhr) {
xhr.setRequestHeader("AJAX", "true");
},
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
success : function(data){
if(data == "ERROR"){
}else{
}
},
error:function(xhr, status, error){
if(xhr.status == 403){
location.href="<c:url value="/login/intro.do' />";
}
@RequestMapping(value="xxx", method = RequestMethod.POST)
@ResponseBody
public String xxxx(HttpServletRequest request, HttpServletResponse response, @ModelAttribute xxxVO vo){
result="SUCCESS" or result="ERROR"
return result;
<c:when test="">
<select id="selStatusCd${lineIndex.index}" onchange="changeStatusCode('${id}', '${status}', 'selStatusCd${lineIndex.index}');" onfocus="beforeStatusCode(this);">
<option value="">${statuscode}</option>
<option value="R" <c:if test="${statusCode == 'R'}">selected="selected"</c:if>>Ready</option>
</select>
</c:when>
</c:choose>
var changeParams, beforeValue, beforeSelId;
function beforeStatusCode(obj){
beforeValue = obj.value;
}
function unchangedStatusCode() {
$("#"+beforeSelId).val(beforeValue);
}
function changeStatusCode(id, previousStatus, selId){
changeParams = {
'id' : id,
'previousStatus' : previousStatus,
'statusCode' : $("#"+selId).val()
};
beforeSelId = selId;
var msg = 'Do you confirm to chage the [' + id + '] status ?';
$('#messageValue1").text(msg);
$.dimPopup.init();
$.dimPopup.layerOpen("#confirm_popup);
}
function doChnageStatusCode() {
$.ajax({
url : "<c:url value='/xxx.do' />",
type: 'post',
data : changeParams,
beforeSend : function(xhr) {
xhr.setRequestHeader("AJAX", "true");
},
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
success : function(data){
if(data == "ERROR"){
}else{
}
},
error:function(xhr, status, error){
if(xhr.status == 403){
location.href="<c:url value="/login/intro.do' />";
}
@RequestMapping(value="xxx", method = RequestMethod.POST)
@ResponseBody
public String xxxx(HttpServletRequest request, HttpServletResponse response, @ModelAttribute xxxVO vo){
result="SUCCESS" or result="ERROR"
return result;
'백엔드개발 > 자바스프링' 카테고리의 다른 글
앱)대량호출 방어로직 및 checkusersession (0) | 2018.11.14 |
---|---|
앱)mybatis resultMap과 resultType 차이 (0) | 2018.11.14 |
앱)mysql sequence 쿼리 샘플 (0) | 2018.11.14 |
앱)mybatis config.xml (0) | 2018.11.14 |
앱)spring transaction properties mybatis Config설정 예시 샘플 (0) | 2018.11.08 |