To keep it simple, I'm looking for a way to handle information being pasted from clipboard to a handsontable. I was reading a post from another stackoverflow post that to retrieve pasted information from clipboard using jQuery:
$("#haras_excel_like_table").bind("paste", function(e){
// access the clipboard using the api
var pastedData = e.originalEvent.clipboardData.getData('Text');
console.log(pastedData);
});
However, that does not work on the handsontable (it does work on the body).
I then tried adding the bind event to each cell in the handsontable, however that did not work as well.
I have also looked through all handsontable methods to see if they thought about implementing something like this, but apparantely they haven't. Methods handsontable
Does anyone have a solution on how to intercept pasted information from the clipboard before actually pasting it to the handsontable? Thanks.
This seems to work for some reason.
$(document.body).on("paste", function(e){
// access the clipboard using the api
var pastedData = e.originalEvent.clipboardData.getData('text');
console.log(pastedData);
if($(e.target).prop('nodeName') == 'TEXTAREA'){
}
});
but is not the optimal solution.