이벤트 활용

paste bind와 callback

엑셀 데이터를 Copy한 후 그리드에 paste시 활용할 수 있는 방법입니다.

bind
paste가 처리된 후 발생되는 이벤트를 바인딩

qcell.bind("paste", function(e,strData){
// access the clipboard using the api
var pastedData = strData !== undefined ? strData : e.originalEvent.clipboardData.getData('text');
console.log('paste');
}

callback
callback은 paste 전에 데이터를 검사하거나 전처리할 수 있도록 제공하는 callback 함수입니다.

처리 후 return을 해줘야 해당 데이터가 그리드에 반영이 됩니다.

beforepastecallback : function(nStartRow,nStartCol,strData){
console.log(nStartRow + ' ' + nStartCol + ' ' + strData);
return '1 ' + strData;
},



엑셀 열어 copy & paste를 해보신 후 브라우저의 콘솔창을 확인해 보시길 바랍니다.