본문 바로가기

웹 개발

자바스크립트 array remove() Array.prototype.remove = function(idx) { return (idxthis.length) ? this : this.slice(0, idx).concat(this.slice(idx+1, this.length)); }; 출처 : http://stove99.tistory.com/90
Maven Ant Tasks http://maven.apache.org/ant-tasks/download.html 에서 최신 버전을 다운로드 받자. 해당 jar 파일은 ant에서 maven 의존성 관리를 위해 필요하다. 만약 build.xml의 위치가 아래와 같다면 다운 받은 jar 파일의 위치는 build.xml에서 바라보는 경로를 명시해 주어야 한다. 위 classpath 처럼 build.xml위 위치에서 jar파일 위치를 적어주면 ant에서 maven 사용이 가능하다. ${main.project.root}는 build.properties에 정의한 것인데 그냥 프로젝트 절대 경로이다. 예로 윈도우일 경우 D:\project 일 수도 있고 Linux 일 경우 /home/project/ 일 수도 있다. pom.xml을 pom이란 i..
같은 소스, 같은 브라우저, 다른 서버, 다른 결과 Local - Windows 7 Server - Ubuntu 12.0 Local에선 크로스 브라우징 코드가 먹힌다. 이걸 확인한 후 서버로 올리니 서버는 익스플로러에서는 IE9만 결과가 나온다. 지금까지 조치... 1. Apache2 cache 해제 js/html/css 등 Apache가 기본적으로 캐시하는것들을 해제하여 페이지 로드시 읽어들이게 변경. -> 해결 안됨. FileETag None Header unset ETag Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" Header set Pragma "no-cache" Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT" 2. ..
script에서 trim 사용하기. String.prototype.trim = function(){ return this.replace(/(^\s*)|(\s*$)/gi, ""); }; String.prototype.ltrim = function(){ return this.replace(/(^\s+)/, ""); }; String.prototype.rtrim = function(){ return this.replace(/(\s+$)/, ""); }; 사용법은.. var str = 'ABC ' ; str.trim();
extjs grid 헤더 통합 및 하단 합계 추가. 그리드 사용중 헤더 통합, 하단에 합계를 노출해야할 업무가 있다. features에 ftype을 summary로 해서 통계 기능을 이용하면 된다. 기본적으로 sum, max, min, average, count를 제공한다. //commify는 0,000 포맷으로 변환해주는 펑션 function summaryRenderer(value, summaryData, dataIndex) { if(Number(value) > 0) value = commify(Number(value)); return value+ ' 명'; } grid = Ext.create('Ext.grid.Panel', { store : store, stateful : false, collapsible : false, multiSelect : fa..
extjs grid dataStore onLoad 처리. extjs grid에서 dataStore를 모두 불러왔을때 이벤트 처리를 해야할 경우가 생겼다. 이전의 삽질을 바탕으로 listener를 먼저 생각했고, 이벤트는 onLoad, afterLoad 등 하다가 단순하게 load를 하니 작동한다. // create the Data Store store = Ext.create('Ext.data.Store', { pageSize: 20, model: 'QnA', //remoteSort: true, proxy: new Ext.data.HttpProxy({ extraParams : jQuery('form[name="searchForm"]').formParams(), url: REMOTE_URL, reader: new Ext.data.JsonReader( { root:..
extjs grid double click event grid에서 컬럼을 클릭, 더블클릭 하는 이벤트는 리스너로 등록을 해주어야 한다. 플렉스와 비슷하여 이해하는데 많은 시간이 걸리지 않으나, 이벤트 타입을 찾는데 시간을 너무 소비 했다. 이벤트 타입은 extjs의 API Docs를 통해 확인할 수 있으며, 자세한 정보는 Ext.view.View의 event 항목을 보면된다. // 그리드 생성 grid = Ext.create('Ext.grid.Panel', { store : store, stateful : true, collapsible : true, stateId : 'stateGrid', columns : [ /* * 헤더와 컬럼의 정렬이 동일할 경우 align 만 사용 * 헤더 정렬 -> style: 'text-align:center' * 컬럼 정렬 ..
extjs grid 헤더와 컬럼 따로 정렬하기 기본적으로 extjs4에서는 헤더와 컬럼은 동일하게 정렬된다. 이를 개별로 지정하는 속성은 따로 없고, 스타일로 지정을 해 주어야 한다. 자세한 것은 바로 코드로 확인할 수 있다. // 그리드 생성 grid = Ext.create('Ext.grid.Panel', {store : store, stateful : true, collapsible : true, stateId : 'stateGrid',columns : [ /* * 헤더와 컬럼의 정렬이 동일할 경우 align 만 사용 * 헤더 정렬 -> style: 'text-align:center' * 컬럼 정렬 -> align:' { left || center || right }' */ { text : '직원명', width : 150,sortable : f..