중간백업

This commit is contained in:
KNKIM 2021-07-27 09:34:06 +09:00
parent 43af6f01dc
commit 979d7361bd
3 changed files with 52 additions and 74 deletions

View File

@ -97,6 +97,10 @@ public class BoardController extends NlibCommonController
String pageIndex = paramMap.get("pageIndex"); String pageIndex = paramMap.get("pageIndex");
String pageSize = paramMap.get("pageSize"); String pageSize = paramMap.get("pageSize");
log.debug("listQnAs > pageIndex = " + pageIndex);
log.debug("listQnAs > pageSize = " + pageSize);
log.debug("listQnAs > searchKeyword = " + searchKeyword);
// 페이징 사이즈 코드 목록 조회 // 페이징 사이즈 코드 목록 조회
DataApiReqVO reqVOforPageSize = new DataApiReqVO(); DataApiReqVO reqVOforPageSize = new DataApiReqVO();
reqVOforPageSize.setAuthKey(createAuthKey(req, authentication)); reqVOforPageSize.setAuthKey(createAuthKey(req, authentication));
@ -108,9 +112,10 @@ public class BoardController extends NlibCommonController
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("pageSizeCodes", resVOforPageSize.getList());
log.debug("listQnAs > pageSizeCodes : " + resVOforPageSize.getList()); model.addAttribute("pageSizeCodes", resVOforPageSize.getList());
//log.debug("listQnAs > pageSizeCodes : " + resVOforPageSize.getList());
return "nlib/board/listQnAs"; return "nlib/board/listQnAs";
} }
@ -128,9 +133,9 @@ public class BoardController extends NlibCommonController
String pageIndex = paramMap.get("pageIndex"); String pageIndex = paramMap.get("pageIndex");
String pageSize = paramMap.get("pageSize"); String pageSize = paramMap.get("pageSize");
log.debug("listQnAs > pageIndex = " + pageIndex); log.debug("listQnAsAjax > pageIndex = " + pageIndex);
log.debug("listQnAs > pageSize = " + pageSize); log.debug("listQnAsAjax > pageSize = " + pageSize);
log.debug("listQnAs > searchKeyword = " + searchKeyword); log.debug("listQnAsAjax > searchKeyword = " + searchKeyword);
//------------------------------- //-------------------------------
// REQ VO 구성 // REQ VO 구성
@ -148,8 +153,6 @@ public class BoardController extends NlibCommonController
// 요청 // 요청
DataApiResVO resVO = boardService.listQnAs(reqVO); DataApiResVO resVO = boardService.listQnAs(reqVO);
//------------------------------- //-------------------------------
// JSON변환 응답 처리 // JSON변환 응답 처리
//------------------------------- //-------------------------------
@ -157,7 +160,6 @@ public class BoardController extends NlibCommonController
// {data: [{...}], // {data: [{...}],
// itemsCount: 255 // itemsCount: 255
// } // }
HashMap<String, Object> retMap = new HashMap<String, Object>(); HashMap<String, Object> retMap = new HashMap<String, Object>();
retMap.put("data", resVO.getList()); retMap.put("data", resVO.getList());
retMap.put("itemsCount", resVO.getRecordTotCount()); retMap.put("itemsCount", resVO.getRecordTotCount());

View File

@ -95,10 +95,12 @@ var articleTypes = [
//======================================================= //=======================================================
$("#jsGrid").jsGrid({ $("#jsGrid").jsGrid({
autoload: true, /* 화면로드된 후, 자동 loadData 처리 여부 */ /*autoload: true, 화면로드된 후, 자동 loadData 처리 여부 */
autoload: false,
pageSize : $("#pageSize").val(),
controller: { controller: {
loadData: function (filter) { loadData: function (filter) {
var data = $.Deferred(); var data = $.Deferred();
//====================================== //======================================
@ -106,10 +108,8 @@ $("#jsGrid").jsGrid({
//====================================== //======================================
var reqUrl = "${pageContext.request.contextPath}/board/listQnAsAjax.do"; var reqUrl = "${pageContext.request.contextPath}/board/listQnAsAjax.do";
var searchKeyword = document.articleForm.searchKeyword.value; var searchKeyword = document.articleForm.searchKeyword.value;
//var pageIndex = document.articleForm.pageIndex.value; var pageIndex = ( filter && filter.pageIndex ? filter.pageIndex : $("#pageIndex").val());
var pageIndex = filter.pageIndex; var pageSize = ( filter && filter.pageSize ? filter.pageSize : $("#pageSize").val());
//var pageSize = document.articleForm.pageSize.value;
var pageSize = filter.pageSize;
var inputData = { var inputData = {
"searchKeyword" : searchKeyword /*encodeURIComponent(searchKeyword)*/ "searchKeyword" : searchKeyword /*encodeURIComponent(searchKeyword)*/
@ -117,6 +117,9 @@ $("#jsGrid").jsGrid({
, "pageSize": pageSize}; , "pageSize": pageSize};
console.log(JSON.stringify(inputData)); console.log(JSON.stringify(inputData));
console.log(JSON.stringify(filter));
$("#pageIndex").val(pageIndex);
//-------------------------------------- //--------------------------------------
// 요청 처리 // 요청 처리
@ -165,17 +168,14 @@ $("#jsGrid").jsGrid({
}); });
$("#pageSize").on("change", function(e) { $("#pageSize").on("change", function(e) {
//alert(e.target.value); //$("#jsGrid").jsGrid("search", {'pageIndex':1,'pageSize':e.target.value});
//$("#jsGrid").jsGrid("option", "pageIndex", 1).("option", "pageSize", e.target.value); $("#pageIndex").val("1");
//$("#jsGrid").jsGrid("loadData", {"pageIndex":2,"pageSize":50}); fn_search_article();
//fn_search_article();
//$("#jsGrid").controller.loadData({"pageIndex":2,"pageSize":50});
//$("#jsGrid").jsGrid("loadData()");
$("#jsGrid").jsGrid("search", {'pageIndex':'2','pageSize':e.target.value});
//$("#jsGrid").jsGrid("search", {'pageIndex':2,'pageSize':50});
}); });
$("#jsGrid").jsGrid("option", "pageIndex", $("#pageIndex").val(), "pageSize", $("#pageSize").val()); $("#btnSearch").on("click", function(e) {
fn_search_article();
});
// 선택한 게시글 상세 보기로 이동 // 선택한 게시글 상세 보기로 이동
function fn_view_detail(articleNo) { function fn_view_detail(articleNo) {
@ -184,47 +184,18 @@ function fn_view_detail(articleNo) {
$("#articleForm").submit(); $("#articleForm").submit();
} }
function fn_search_article() { function fn_search_article(pageSize, pageIndex) {
$("#jsGrid").jsGrid("loadData"); console.log("fn_search_article 1 : param > " + pageSize + ", " + pageIndex);
console.log("fn_search_article 2 : recalc > " + (pageSize ? pageSize : $("#pageSize").val()) + ", " + (pageIndex ? pageIndex : $("#pageIndex").val()));
$("#jsGrid").jsGrid("search"
, {'pageSize':(pageSize ? pageSize : $("#pageSize").val()),
'pageIndex':(pageIndex ? pageIndex : $("#pageIndex").val())
} }
);
function fn_search_article2() {
var searchKeyword = document.articleForm.searchKeyword.value;
var pageIndex = document.articleForm.pageIndex.value;
var pageSize = document.articleForm.pageSize.value;
var inputData = {
"searchKeyword" : searchKeyword /*encodeURIComponent(searchKeyword)*/
,
"pageIndex" : pageIndex,
"pageSize" : pageSize
};
//alert(JSON.stringify(inputData));
$.ajax({
url : "${pageContext.request.contextPath}/board/listQnAsAjax.do",
contentType : "application/json; charset=utf-8", /* */
type : "post",
data : JSON.stringify(inputData),
dataType : 'json', /* Server Response Data Type */
async : true,
success : function(returnData, status) {
var jsonObj = JSON.parse(returnData);
alert("record=" + JSON.stringify(jsonObj));
$("#jsGrid").jsGrid("data") = jsonObj;
},
error : function(data) {
alert("조회에 실패하였습니다.\n" + data.code + " : " + data.message);
}
});
} }
function fn_init() { function fn_init() {
//fn_search_article(); $("#jsGrid").jsGrid("search", {'pageIndex':$("#pageIndex").val(),'pageSize':$("#pageSize").val()});
document.articleForm.searchKeyword.focus();
//$("#jsGrid").jsGrid("loadData");
//$("#jsGrid").jsGrid("data") = client2;
} }
</script> </script>

View File

@ -1085,10 +1085,14 @@
}, },
loadData : function(filter) { loadData : function(filter) {
filter = filter || (this.filtering ? this.getFilter() : {});
//$.extend(filter, this._loadStrategy.loadParams(), this // NLIB : 파라메터값이 기존 설정값으로 대체 막음
// ._sortingParams()); if(filter) {
if(filter.pageSize) this.pageSize = filter.pageSize;
if(filter.pageIndex) this.pageIndex = filter.pageIndex;
}
filter = filter || (this.filtering ? this.getFilter() : {});
$.extend(this._loadStrategy.loadParams(), filter, this $.extend(this._loadStrategy.loadParams(), filter, this
._sortingParams()); ._sortingParams());
@ -1685,7 +1689,8 @@
}, },
openPage : function(index) { openPage : function(index) {
this._grid.loadData(); //this._grid.loadData();
this._grid.loadData({"pageIndex": index}); // NLIB
}, },
loadParams : function() { loadParams : function() {