목록WEB/Front (7)
hello world
타임리프 문법 관련 사용했던거 정리... 1. Thymeleaf 음수 금액인 경우 글자색 바꾸기 (특정 글자포함여부 체크하여 글자색상 바꾸기) ( '-' 문자를 포함하고있는지로 구분해서분기처리함) 2. Thymeleaf 문자열 합치기 |로 감싸주면 문자열을 조합할 수 있다. 그냥도 가능함 3.Thymeleaf 값 비었는지 확인 ${#strings.isEmpty(~)} 문자열,배열,list,set 비었는지 확인 ${#strings.isEmpty(title)} ${#strings.arrayIsEmpty(array)} ${#strings.listIsEmpty(list)} ${#strings.setIsEmpty(set)} 4. Thymeleaf select 값에 따라 선택되어지는 값 세팅하기 Y N 5. Thy..

통계화면 개발중 하위부서의누적합을 구현하는것이 필요했다. mysql에서 recursive 기능을 제공하지않는 버전을 사용하고 있었기에 자바스크립트에서 map, reduce 메서드를 통해 통계 누적합을 구함 참고코드 map 메서드 - map 메서드는 다음과 같이 사용함 배열.map((요소, 인덱스, 배열) => {return 요소}); - map은 반복문을 돌면서 배열 안의 요소들을 1대1로 짝지어줌 (매핑한다고 표현) const hello = [1, 2, 3]; let result = hello.map((v) => { console.log(v); return v; }); hello; // [1, 2, 3] result; // [1, 2, 3] const number = [1,2,3,4] const map..
[특정 문자열 포함 확인 함수] 1.자바스크립트 : includes 함수 사용 var str="hello"; boolean isIncludeStr = str.includes("h"); //str은 h라는 문자를 포함하고 있으므로 true 반환 //isIncludeStr=true 가 된다. *includes 함수는 true/false를 반환한다. *대소문자가 다를경우 다른 문자로 인식 *includes 이외에 search 함수 , indexof 함수도 이와 유사한 함수이나 index를 리턴한다. ** 익스플로러에서는 includes 함수가 사용시 에러가 난다. indexOf를 사용하자 indexOf 는 true/false를 반환하지 않고 해당하는 문자열이 시작하는 index 값을 반환한다. 해당하는 문자열..
[자바스크립트 : 현재 url 주소 가져오기] 1. 현재 URL 전체를 가져옴 http://localhost:8080/mbr/bbslist.do 자바스크립트 : window.location.href 제이쿼리 : $(location).attr('href') 2. 현재 경로 가져옴 /mbr/bbslist.do 자바스크립트: window.location.pathname 제이쿼리 : $(location).attr('pathname') window.location.hostname window.location.pathname window.location.href window.location.port window.location.protocol [자바 :현재 url 가져오기] 1. 현재 URL 전체를 가져옴 http..
$(document).on() : 동적 이벤트를 할당 $(document).off() : 이벤트를 해제 $(document).off() 형태 1) $(객체).off() $(document).off(); 2) $(객체).off(eventName) $(document).off("Click"); 3) $(객체).off(eventName, function); function fn(){ alert("야호"); } $(document).off("click",fn); $(document).off() , $(document).on() 사용시 주의 사항 $(document).on("click") 과 같은 코드는 다른 페이지에도 영향을 준다. 그래서 $(document).off("click") 를 사용하여 해제 시켜주면 ..

제이쿼리 함수 정리 1) gridDiv 라는 아이디를 가진 그리드 안의 e-row 클래스에 특정 속성 추가하기 : attr() 사용 attr ()는 요소의 속성(attr)의 값을 가져오거나 속성을 추가한다. $("#gridDiv .e-row").attr("check-selected", true) $("#elmtId").attr(attrName, value) : check-select 라는 이름을 가진 속성에 true 라는 value 값 추가 $("#elmtId").attr(attrName) : check-select 라는 속성의 값을 가져온다. 2 ) removeAttr() $("#gridDiv .e-row").removeAttribute("check-selected"); 선택한 요소("#gridDiv ..

자바스크립트 동적으로 생성된 요소에 이벤트 걸기 동적으로 생성된 노드, 혹은 그리드 같은 요소에는 아래와 같이 함수를 쓸경우 이벤트가 발생하지 않는 문제가 있었다. $('#elmtId').click(function(){ aleart("클릭 이벤트"); }) 해결 방안은 on 함수로 이벤트를 걸어주는 것 ...! documetn.on()을 사용하는 것 $(document).on("click","#elmtId",function(){ aleart("클릭 이벤트"); }); 혹은 $("#elmtId").on("click",function(){ aleart("클릭 이벤트"); }); 사용하면 된다고 하는데 그리드에서는 2번째는 적용되지 않는듯하다. documetn.on()을 사용했을 때 이벤트가 중복 발생하는 문..