자주하는질문 기능 추가

This commit is contained in:
KNKIM 2021-08-04 15:25:28 +09:00
parent e99528ea7c
commit 0913ab07f1
5 changed files with 103 additions and 15 deletions

View File

@ -6,32 +6,83 @@
<records>125</records> <records>125</records>
<results> <results>
<articleNo>1</articleNo> <articleNo>1</articleNo>
<title>질문있습니다.</title> <faqType>회원가입</faqType>
<title>질문있습니다.1</title>
<articleGubun>Q</articleGubun> <articleGubun>Q</articleGubun>
<articleType>101</articleType> <articleType>101</articleType>
<articleTypeName>회원가입</articleTypeName> <articleTypeName>회원가입</articleTypeName>
</results> </results>
<results> <results>
<articleNo>2</articleNo> <articleNo>2</articleNo>
<title>질문있습니다.</title> <faqType>회원가입</faqType>
<title>질문있습니다.2</title>
<articleGubun>Q</articleGubun> <articleGubun>Q</articleGubun>
<articleType>101</articleType> <articleType>101</articleType>
<articleTypeName>회원가입</articleTypeName> <articleTypeName>회원가입</articleTypeName>
</results> </results>
<results> <results>
<articleNo>3</articleNo> <articleNo>3</articleNo>
<title>질문있습니다.</title> <faqType>자료대출</faqType>
<title>질문있습니다.3</title>
<articleGubun>Q</articleGubun> <articleGubun>Q</articleGubun>
<articleType>101</articleType> <articleType>101</articleType>
<articleTypeName>회원가입</articleTypeName> <articleTypeName>회원가입</articleTypeName>
</results> </results>
<results> <results>
<articleNo>4</articleNo> <articleNo>4</articleNo>
<title>질문있습니다.</title> <faqType>자료대출</faqType>
<title>질문있습니다.4</title>
<articleGubun>Q</articleGubun>
<articleType>101</articleType>
<articleTypeName>회원가입</articleTypeName>
</results>
<results>
<articleNo>5</articleNo>
<faqType>자료대출</faqType>
<title>질문있습니다.5</title>
<articleGubun>Q</articleGubun>
<articleType>101</articleType>
<articleTypeName>회원가입</articleTypeName>
</results>
<results>
<articleNo>1</articleNo>
<faqType>회원가입</faqType>
<title>질문있습니다.1</title>
<articleGubun>Q</articleGubun>
<articleType>101</articleType>
<articleTypeName>회원가입</articleTypeName>
</results>
<results>
<articleNo>2</articleNo>
<faqType>회원가입</faqType>
<title>질문있습니다.2</title>
<articleGubun>Q</articleGubun>
<articleType>101</articleType>
<articleTypeName>회원가입</articleTypeName>
</results>
<results>
<articleNo>3</articleNo>
<faqType>자료대출</faqType>
<title>질문있습니다.3</title>
<articleGubun>Q</articleGubun>
<articleType>101</articleType>
<articleTypeName>회원가입</articleTypeName>
</results>
<results>
<articleNo>4</articleNo>
<faqType>자료대출</faqType>
<title>질문있습니다.4</title>
<articleGubun>Q</articleGubun>
<articleType>101</articleType>
<articleTypeName>회원가입</articleTypeName>
</results>
<results>
<articleNo>5</articleNo>
<faqType>자료대출</faqType>
<title>질문있습니다.5</title>
<articleGubun>Q</articleGubun> <articleGubun>Q</articleGubun>
<articleType>101</articleType> <articleType>101</articleType>
<articleTypeName>회원가입</articleTypeName> <articleTypeName>회원가입</articleTypeName>
</results> </results>
</result> </result>

View File

@ -226,20 +226,26 @@ public class BoardController extends NlibCommonController
log.debug("listFAQs > message = " + message); log.debug("listFAQs > message = " + message);
log.debug("listFAQs > faqType = " + faqType); log.debug("listFAQs > faqType = " + faqType);
// 페이징 사이즈 코드 목록 조회
DataApiReqVO reqVOforCode = new DataApiReqVO(); DataApiReqVO reqVOforCode = new DataApiReqVO();
reqVOforCode.setAuthKey(createAuthKey(req, authentication)); reqVOforCode.setAuthKey(createAuthKey(req, authentication));
reqVOforCode.setPageIndex(pageIndex); reqVOforCode.setPageIndex(0);
reqVOforCode.setPageSize(pageSize); reqVOforCode.setPageSize(0);
reqVOforCode.addInfoItem("codeUpperId", "FAQ_TYPE"); // 페이징 사이즈 코드 목록 조회
reqVOforCode.addInfoItem("codeUpperId", "PAGE_SIZE");
DataApiResVO resVOforPageSize = codeService.listCodes(reqVOforCode); DataApiResVO resVOforPageSize = codeService.listCodes(reqVOforCode);
// 유형 코드 목록 조회
reqVOforCode.addInfoItem("codeUpperId", "FAQ_TYPE");
DataApiResVO resVOforFaqType = codeService.listCodes(reqVOforCode);
// 반환 정보 // 반환 정보
model.addAttribute("pageIndex" , pageIndex); model.addAttribute("pageIndex" , pageIndex);
model.addAttribute("pageSize" , pageSize); model.addAttribute("pageSize" , pageSize);
model.addAttribute("searchKeyword", searchKeyword); model.addAttribute("searchKeyword", searchKeyword);
model.addAttribute("faqTypeCodes" , resVOforPageSize.getList()); model.addAttribute("pageSizeCodes", resVOforPageSize.getList());
model.addAttribute("faqTypeCodes" , resVOforFaqType.getList());
model.addAttribute("message" , message); model.addAttribute("message" , message);
model.addAttribute("faqType" , faqType);
model.addAttribute("faqType" , faqType); model.addAttribute("faqType" , faqType);
return "nlib/board/listFAQs"; return "nlib/board/listFAQs";

View File

@ -52,6 +52,7 @@
//======================================================= //=======================================================
$("#jsGrid").jsGrid({ $("#jsGrid").jsGrid({
pageSize : $("#pageSize").val(), pageSize : $("#pageSize").val(),
scrollOffset:0,
controller: { controller: {
loadData: function (filter) { // 그리드에 데이터를 가져올 때 실팽되는 함수 loadData: function (filter) { // 그리드에 데이터를 가져올 때 실팽되는 함수
var data = $.Deferred(); var data = $.Deferred();
@ -101,7 +102,7 @@
// 추출할 컬럼의 데이터 가져오기 // 추출할 컬럼의 데이터 가져오기
var articleNo = getData["articleNo"]; var articleNo = getData["articleNo"];
var selectedRow = $("#jsGrid").find('table tr.highlight'); var selectedRow = $("#jsGrid").find('table tr.jsgrid-selected-row');
// 상세 내용 보기 // 상세 내용 보기
fn_viewDetail(articleNo, selectedRow); fn_viewDetail(articleNo, selectedRow);
@ -122,6 +123,12 @@
fn_searchArticle($("#pageSize").val(), 1); fn_searchArticle($("#pageSize").val(), 1);
}); });
// 유형 변경시 재조회
$("#faqType").on("change", function(e) {
fn_searchArticle($("#pageSize").val(), 1);
});
// 검색 버튼 클릭 // 검색 버튼 클릭
$("#btnSearch").on("click", function(e) { $("#btnSearch").on("click", function(e) {
fn_searchArticle($("#pageSize").val(), 1); fn_searchArticle($("#pageSize").val(), 1);
@ -159,9 +166,21 @@
dataType: "json", dataType: "json",
data: JSON.stringify(inputData), data: JSON.stringify(inputData),
}).done(function(response){ }).done(function(response){
$selectedRow.css("color","red"); var jsonObj = JSON.parse(response);
$("#jsGrid").find('table tr.answer').remove();
//alert("DDDDDDDD remove = " + $("#jsGrid")[0].scrollHeight);
$selectedRow.after("<tr class='answer'><td colspan='3'>" + jsonObj.content
+ "<br/>" + jsonObj.content
+ "<br/>" + jsonObj.content
+ "<br/>" + jsonObj.content
+ "<br/>" + jsonObj.content
+ "</td></tr>");
//alert("DDDDDDDD add = " + $("#jsGrid")[0].scrollHeight);
//$("#jsGrid").find('table.jsgrid-table.jsgrid-grid-body').height($("#jsGrid").find('table.jsgrid-table')[0].scrollHeight + 100);
}); });
$("#jsGrid").closest('.ui-jqgrid-bdiv').width($("#jsGrid").closest('.ui-jqgrid-bdiv').width() + 1);
} }
// 게시글 작성으로 이동 // 게시글 작성으로 이동
@ -180,6 +199,11 @@
); );
} }
function fn_changeFaqType(selectedFaqType) {
$('#faqType').val(selectedFaqType).trigger('change');
}
</script> </script>
</head> </head>
@ -210,6 +234,13 @@
<input type="text" name="searchKeyword" id="searchKeyword" title="검색어" value="${searchKeyword }" size="35" maxlength="50" /> <input type="text" name="searchKeyword" id="searchKeyword" title="검색어" value="${searchKeyword }" size="35" maxlength="50" />
<input type="button" name="btnSearch" id="btnSearch" title="검색버튼" value="검색" /> <input type="button" name="btnSearch" id="btnSearch" title="검색버튼" value="검색" />
<br/>
<a href="javascript:void(0)" onclick="fn_changeFaqType('')" <c:if test="${'' == faqType }"> class="selected" </c:if> >전체</a>
<c:forEach var="faqTypeItem" items="${faqTypeCodes}" varStatus="status">
<a href="javascript:void(0)" onclick="fn_changeFaqType('<c:out value="${faqTypeItem.code }" />')" <c:if test="${faqTypeItem.code == faqType }"> class="selected" </c:if> ><c:out value="${faqTypeItem.name }" /></a>
</c:forEach>
<div id="jsGrid" name="jsGrid" style="height: 100%"></div> <div id="jsGrid" name="jsGrid" style="height: 100%"></div>

View File

@ -32,8 +32,8 @@
} }
.jsgrid-grid-body { .jsgrid-grid-body {
overflow-x: auto; /*overflow-x: auto;
overflow-y: scroll; overflow-y: scroll;*/ /* NLIB */
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;
} }