본문 바로가기

javascript

(75)
자바스크립트 module 개념 module 모듈 시스템은 2015년에 표준. 모듈은 단지 파일 하나에 불과합니다. 스크립트 하나는 모듈 하나입니다. 분리된 파일 -> module 대개 클래스 하나 or 특정한 목적을 가진 복수의 함수로 구성된 라이브러리 하나. script 태그에 type="module" 어트리뷰트를 추가해주면, 이 파일은 모듈로서 동작합니다. 모듈 스코프에서 정의된 이름은 export 구문을 통해 다른 파일에서 사용할 수 있습니다. 주의할 점이 한 가지 있습니다. import 구문과 export 구문은 모듈 간 의존 관계를 나타내는 것일 뿐, 코드를 실행시키라는 명령이 아니라는 것입니다. 모듈은 자신만의 스코프가 있습니다. 따라서 모듈 내부에서 정의한 변수나 함수는 다른 스크립트에서 접근할 수 없습니다. 참고 : h..
openlayers 참고 https://openlayers.org/doc/tutorials/concepts.html OpenLayers - Basic Concepts Basic Concepts Map The core component of OpenLayers is the map (from the ol/Map module). It is rendered to a target container (e.g. a div element on the web page that contains the map). All map properties can either be configured at construction time, or b openlayers.org https://wldnjd2.tistory.com/23 OpenLayers Map 띄..
Tabulator 타블레이터 그리드(테이블) 2개 그리드1 : tableTempData = [ {ORIGIN:"남구", DETINATION:"남구", passage:"999,999", GRP_ID:"01"}, {ORIGIN:"동구", DETINATION:"남구", passage:"999,999", GRP_ID:"02"}, {ORIGIN:"서구", DETINATION:"남구", passage:"999,999", GRP_ID:"03"} ]; dsrcOD.grid1 = new Tabulator('#'+dsrcOD.pv+'Grid_od',{ data : tableTempData, placeholder:"No Data Set", movableRows:true, movableRowsConnectedTables:'#'+dsrcOD.pv+'Grid', movableR..
오픈레이어스 선 긋기 OpenLayers LineString OpenLayers 버전 v7.4.0 오픈레이어스 선 긋기 예제.. 이거 하나 하느라 몇시간을 불태웠는지.. 후.. 역시 알고나면 아무것도 아닌데, 알기전에는 너무 스트레스다. html : js : // OpenLayers에서 맵을 생성합니다. var map = new ol.Map({ target: 'map', // 맵이 표시될 영역의 ID를 지정합니다. layers: [ // 기본적으로 사용할 레이어를 추가합니다. 여기서는 OSM (OpenStreetMap)을 사용합니다. new ol.layer.Tile({ source: new ol.source.OSM() }) ], view: new ol.View({ center: ol.proj.fromLonLat([127.0287172, 37.2635620]), /..
canvas 크기 설정 시 제대로 적용 안될 때 ( chartjs 등 라이브러리사용시 ) chartjs라던가 라이브러리를 사용하면서 canvas를 사용중이라면 canvas의 크기가 지멋대로 설정되는 듯 느낀 경우가 있을 것이다. 해결 방법은 canvas를 감싸고 있는 부모 엘리먼트에 position:relative 속성을 주어서 해결 할 수 있다. 라이브러리를 사용하다보면, 미처 깨닫지 못한 부분의 영향을 받고 있는데 그걸 발견하지 못해서 생기는 경우가 허다하다. 일단 간단하게 canvas 사용시에는 부모에게 position:relative 속성으로 해결함.
w2ui 데이터 refresh 후 원하는 행으로 이동 w2ui에서 row가 100개라고 가정할 때, 50번째 데이터를 수정하고 refresh를 했을 경우 바로 50번째 줄 데이터를 볼 수 있는 방법은 ? scrollIntoView 메소드 사용. https://w2ui.com/web/docs/1.5/w2grid.scrollIntoView w2grid.scrollIntoView | JavaScript UI - w2ui Scrolls to the specified records scrollIntoView([ind], [column], [instant]) ind integer, optional, index of the record in records array Returns undefined. Description This method will scroll int..
w2ui 그리드에서 recid를 가져오는 여러가지 방법과 기타등등 w2ui recid를 가져오는 여러가지 방법과 기타등등 w2ui로 작업하다가 까먹지 않기 위해 오늘도 블로그에 메모! w2ui["myGrid"].records[0]["recid"] w2ui["myGrid"].get(1) const recidNum = 1; //-1을 해준이유는 recid는 1부터 시작하는데 배열은 0부터 시작 w2ui["myGrid"].records[recidNum-1]["fieldName1"]; w2ui["myGrid"].records[recidNum-1]["fieldName2"]; 자세한 사용법은 나중에 올리겠다고 다짐하고 일단 포스팅!!
javascript 매개변수 배열 자바스크립트에서 함수에 매개변수를 받을 때, 배열로 받으려면 어떻게 해야 될까? 가볍게 아래와 같이 .... 일단 이렇게 함수를 접근해서 진행해보기로 const testObj = { editPop : function( args ){ const f1 = args[0]; const f2 = args[1]; console.log("Inner : ", f1, f2); } } testObj.editPop(["ab","cd"]);