PureJS flexsheet 엑셀 데이터 초기화 방법
추천0 비추천 0
페이지 정보
작성자 nxdev1 작성일 2024-03-07 16:22 조회 133회 댓글 0건제품 버전 : 5.20221.842
컨트롤 이름 : wijmo.grid.sheet.FlexSheet
본문
관련링크
안녕하세요. 테스트 버튼을 클릭 시
fetch로 data를 받아와
값이 있으면 loadAsync() 함수로 데이터를 띄우고
값이 없으면 아래 사진과 같이 엑셀 데이터를 없는 상태로 초기화하고 싶습니다.
initialize() 함수 사용을 시도했지만
loadAsync()를 통해 전에 로드한 엑셀 데이터가 그대로 있습니다.
어떻게 하면 구현할 수 있을지 알려주시면 감사하겠습니다.
아래는 시도한 코드입니다. 감사합니다.
{ header: '테스트', width: 150, cellTemplate: wijmo.grid.cellmaker.CellMaker.makeButton({ cssClass: 'testButton', text: '테스트', click: (e,ctx) => { console.log(ctx.item.item); fetch('/getLasExcel' ) .then(res => res.blob()) .then(async data => { if (data.size != 0) { //엑셀 로드 await ExcelIOSheet.loadAsync(data); } else{ //초기화가 되지 않음 ExcelIOSheet.initialize(); } } } }
// ExcelIOSheet 선언부 let ExcelIOSheet = new wijmo.grid.sheet.FlexSheet('#excelIOSheet', { selectionChanged: (s,e) => { try{ let selection = e.range; if (selection.isValid) { document.querySelector('.cellContent').value = s.getCellData(selection.row, selection.col, true); document.querySelector('.rowContent').value = e.row; document.querySelector('.colContent').value = e.col; } } catch (e){ } } });
댓글목록
등록된 댓글이 없습니다.