Handsontable example
HTML
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/handsontable-pro@5.0.1/dist/handsontable.full.min.css">
<script src="https://cdn.jsdelivr.net/npm/handsontable-pro@5.0.1/dist/handsontable.full.js"></script>
<div id="example1"></div>
<div class="window">
Anything here...
<button class="hide">x</button>
</div>
CSS
.window {
position: fixed;
width: 300px;
background: #fff;
border: 1px solid #cecece;
visibility: hidden;
float: right;
top: 0;
left: 0;
padding: 5px;
margin: 20px;
box-shadow: 0px 0px 8px -1px #999;
z-index: 104
}
.hide {
background: #85ce6d;
border: 0;
font-size: 10px;
padding: 5px 2px;
width: 30px;
color: #fff;
box-shadow: 0;
float: right;
border-radius: 2px;
}
JavaScript
var data = [
[1, 2, 3, 5],
[8, 9, 5, 6]
],
container = document.getElementById('example1'),
hot;
var win = document.querySelector('.window');
var x, y;
hot = new Handsontable(container, {
data: Handsontable.helper.createSpreadsheetData(20, 20),
rowHeaders: true,
colHeaders: true,
afterBeginEditing: function(row, col) {
console.log(row, col);
win.style.visibility = 'visible';
win.style.marginTop = y + 'px';
win.style.marginLeft = x + 'px';
}
});
document.querySelector('.hide').addEventListener('click', function() {
win.style.visibility = 'hidden'
})
document.querySelector('.handsontable').addEventListener('click', function(e) {
x = e.pageX;
y = e.pageY;
})