2018년 3월 21일 수요일

rmate resort

   //정렬 초기화  function resetSort() {
   gridRoot = gridApp.getRoot();   // collection 개체를 가지고 옵니다.   var acoll = gridRoot.getCollection();   // 정렬할 컬럼 정보를 instance로 지정합니다.      var sortField = gridRoot.newClassInstance("SortField");      // 정렬 함수를 instance로 지정합니다.      var sot = gridRoot.newClassInstance("Sort");   // sort Field를 초기화 합니다.
   sot.setFields([]);   if((acoll != null) &&(acoll != "") &&(typeof acoll !="undefined")){
       acoll.setSort(sot);       // collection 정보를 새로고침합니다.       acoll.refresh();      }
}

2018년 3월 15일 목요일

JAVA DB Data-> to change JSON -> convey to javascript

import net.sf.json.JSONArray;

java

List<HashMap<String, Object>> list = testService.selectInfo(searchVO);

JSONArray jsonArray = JSONArray.fromObject(list);


model.addAttribute("jsonArray", jsonArray);

javascript
console.log("jsonArray %o2 ", '${jsonArray}');


description

list JSONArray.formObject before parse Data

  console.log Data->value "[{DT=20180312, M50=4.44, M30=9.19}]"
  
list JSONArray.formObject after parse Data ->double quotation marks are added to the string
  console.log Data->value "[{"BRD_DT":"20180312","M_50":4.44,"M_30":9.19}]"
    
if json value dont' have double quotation marks , they are not recognized as json data

----
Problem 

if results have some special letters, Javascript dose not work properly.
ex) 'test''tt'
  ->In this case, All column remove some special letter.
ex)
    <c:forEach items="${list}" var="item" varStatus="status">
         var data = {};
         data.RANKNUM = "${item.title}";  //Included quotation ->error
         data.BRD_STD_DT = "${item.BRD_STD_DT}";
    </c:forEach>
SO it is not a good solution.
I recommend to use ajax json .


var result = JSON.parse(data.responseText);
-->This will solve atll the special characters.


Java source Example

JSONObject rv = new JSONObject();
rv.put("paging", pageVO);rv.put("info", service.getInfo(pageVO));
return new ResponseVO(rv, new ResultVO("success", "성공"));
ResponeVO.java


public class ResponseVO {

   private ResultVO resultInfo;   private Object resultContent;      public ResponseVO() {
      //Constructor   }
   
   public ResponseVO(ResultVO resultInfo) {
      this.resultInfo = resultInfo;   }
   
   public ResponseVO(Object resultContent, ResultVO resultInfo) {
      this.resultInfo = resultInfo;      this.resultContent = resultContent;   }
   
   public ResultVO getResultInfo() {
      return resultInfo;   }

   public void setResultInfo(ResultVO resultInfo) {
      this.resultInfo = resultInfo;   }

   public Object getResultContent() {
      return resultContent;   }

   public void setResultContent(Object resultContent) {
      this.resultContent = resultContent;   }

}


2018년 3월 8일 목요일

javascript typeof연산자

자세한 내용은 msdn 참조

https://msdn.microsoft.com/ko-kr/library/259s7zc1(v=vs.94).aspx 
typeof 연산자는 형식 정보를 문자열로 반환합니다.
typeof는 "number", "string", "boolean", "object", "function" 및 "undefined"의 6가지 값을 반환할 수 있습니다.

위 값을 if(val=="undefined")) 이렇게 비교하면 값이 정상적으로 비교되지 않는다

   if(typeof val =="undefined"){
    console.log("undefined");}

위의 값은 꼭 typeof를 사용해서 비교해야한다

2018년 3월 1일 목요일

vue devtools not showing

크롬 개발자 도구에 vue 가 정상적으로 안보일경우 방법

before me create app
Vue.config.devtools = true


after me create app
window.__VUE_DEVTOOLS_GLOBAL_HOOK__.Vue = app.constructor;