중간백업

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

@ -94,8 +94,12 @@ public class BoardController extends NlibCommonController
public String listQnAs(HttpServletRequest req, Authentication authentication, @RequestParam Map<String, String> paramMap, ModelMap model) {
String searchKeyword = paramMap.get("searchKeyword");
String pageIndex = paramMap.get("pageIndex");
String pageSize = paramMap.get("pageSize");
String pageIndex = paramMap.get("pageIndex");
String pageSize = paramMap.get("pageSize");
log.debug("listQnAs > pageIndex = " + pageIndex);
log.debug("listQnAs > pageSize = " + pageSize);
log.debug("listQnAs > searchKeyword = " + searchKeyword);
// 페이징 사이즈 코드 목록 조회
DataApiReqVO reqVOforPageSize = new DataApiReqVO();
@ -105,12 +109,13 @@ public class BoardController extends NlibCommonController
DataApiResVO resVOforPageSize = codeService.listCodes(reqVOforPageSize);
// 반환 정보
model.addAttribute("pageIndex" , pageIndex);
model.addAttribute("pageIndex" , pageIndex);
model.addAttribute("pageSize" , pageSize);
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";
}
@ -128,9 +133,9 @@ public class BoardController extends NlibCommonController
String pageIndex = paramMap.get("pageIndex");
String pageSize = paramMap.get("pageSize");
log.debug("listQnAs > pageIndex = " + pageIndex);
log.debug("listQnAs > pageSize = " + pageSize);
log.debug("listQnAs > searchKeyword = " + searchKeyword);
log.debug("listQnAsAjax > pageIndex = " + pageIndex);
log.debug("listQnAsAjax > pageSize = " + pageSize);
log.debug("listQnAsAjax > searchKeyword = " + searchKeyword);
//-------------------------------
// REQ VO 구성
@ -148,8 +153,6 @@ public class BoardController extends NlibCommonController
// 요청
DataApiResVO resVO = boardService.listQnAs(reqVO);
//-------------------------------
// JSON변환 응답 처리
//-------------------------------
@ -157,7 +160,6 @@ public class BoardController extends NlibCommonController
// {data: [{...}],
// itemsCount: 255
// }
HashMap<String, Object> retMap = new HashMap<String, Object>();
retMap.put("data", resVO.getList());
retMap.put("itemsCount", resVO.getRecordTotCount());

View File

@ -95,10 +95,12 @@ var articleTypes = [
//=======================================================
$("#jsGrid").jsGrid({
autoload: true, /* 화면로드된 후, 자동 loadData 처리 여부 */
/*autoload: true, 화면로드된 후, 자동 loadData 처리 여부 */
autoload: false,
pageSize : $("#pageSize").val(),
controller: {
loadData: function (filter) {
var data = $.Deferred();
//======================================
@ -106,17 +108,18 @@ $("#jsGrid").jsGrid({
//======================================
var reqUrl = "${pageContext.request.contextPath}/board/listQnAsAjax.do";
var searchKeyword = document.articleForm.searchKeyword.value;
//var pageIndex = document.articleForm.pageIndex.value;
var pageIndex = filter.pageIndex;
//var pageSize = document.articleForm.pageSize.value;
var pageSize = filter.pageSize;
var pageIndex = ( filter && filter.pageIndex ? filter.pageIndex : $("#pageIndex").val());
var pageSize = ( filter && filter.pageSize ? filter.pageSize : $("#pageSize").val());
var inputData = {
"searchKeyword" : searchKeyword /*encodeURIComponent(searchKeyword)*/
, "pageIndex" : pageIndex
, "pageIndex" : pageIndex
, "pageSize": pageSize};
console.log(JSON.stringify(inputData));
console.log(JSON.stringify(filter));
$("#pageIndex").val(pageIndex);
//--------------------------------------
// 요청 처리
@ -165,17 +168,14 @@ $("#jsGrid").jsGrid({
});
$("#pageSize").on("change", function(e) {
//alert(e.target.value);
//$("#jsGrid").jsGrid("option", "pageIndex", 1).("option", "pageSize", e.target.value);
//$("#jsGrid").jsGrid("loadData", {"pageIndex":2,"pageSize":50});
//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("search", {'pageIndex':1,'pageSize':e.target.value});
$("#pageIndex").val("1");
fn_search_article();
});
$("#jsGrid").jsGrid("option", "pageIndex", $("#pageIndex").val(), "pageSize", $("#pageSize").val());
$("#btnSearch").on("click", function(e) {
fn_search_article();
});
// 선택한 게시글 상세 보기로 이동
function fn_view_detail(articleNo) {
@ -184,48 +184,19 @@ function fn_view_detail(articleNo) {
$("#articleForm").submit();
}
function fn_search_article() {
$("#jsGrid").jsGrid("loadData");
function fn_search_article(pageSize, pageIndex) {
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() {
//fn_search_article();
document.articleForm.searchKeyword.focus();
//$("#jsGrid").jsGrid("loadData");
//$("#jsGrid").jsGrid("data") = client2;
}
function fn_init() {
$("#jsGrid").jsGrid("search", {'pageIndex':$("#pageIndex").val(),'pageSize':$("#pageSize").val()});
}
</script>

View File

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